Sometimes I have legend labels which are very long and it would be nice to have the option to add a line break (to control the length of the entries). Because this is possible for other labels (thanks to this commit [#11578]) I hope this is also easy to enable for legends.
from bokeh.plotting import figure, show, output_notebook
from bokeh.models import HoverTool
output_notebook()
p = figure(match_aspect=True, width=400, height=400)
# invisble rect to scale the y-axis as workaround
w_h = 2
p.rect(x=0, y=0, width=w_h, height=w_h, alpha=0)
p.wedge(
x=0,
y=0,
radius=1,
start_angle=0,
end_angle=3.1415,
color='blue',
legend_label="Short legend item",
)
p.wedge(
x=0,
y=0,
radius=1,
start_angle=3.1415,
end_angle=6.282,
legend_label="Long legend item\nLinebreaks would be nice.",
color='yellow',
)
show(p)
Problem description
Sometimes I have legend labels which are very long and it would be nice to have the option to add a line break (to control the length of the entries). Because this is possible for other labels (thanks to this commit [#11578]) I hope this is also easy to enable for legends.
Example
In this example you can see, that the second legend item is long and the
\n-newline character is replaced by a whitespace.My wish is to start a new line without the box for the second part of the label.