Line break in categorical axis labels
See original GitHub issueFeature request (similar to #7317)
Please introduce some straightforward way to include line breaks (e.g. “\n” or “<br>”) in labels of categorical axes (currently these are ignored):
factors = ["a very long label \n that needs a break",
"a very long label \\n that needs a break",
"a very long label <br> that needs a break",
]
x = [50, 40, 65,]
p = figure(y_range=factors)
p.circle(x, factors, size=15, fill_color="orange", line_color="green", line_width=3)
show(p)
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:7 (5 by maintainers)
Top Results From Across the Web
how do I create a line break in an axis label - Apple Discussions
First way: Go to the Chart Inspector, Axis tab. At the bottom it will either have references to the header cells it is...
Read more >Line Breaks in Categorical Axis Labels, Bokeh Plots
The x-axis labels overlap, so I'd like to insert line breaks. I cannot figure out how to do this. I have tried adding...
Read more >Line breaks, word wrap and multiline text in chart labels.
Read the guide on how to enable line breaks and word wrapping in axes labels so that it will fit into the available...
Read more >Including line break in variable labels - Statalist
Dear Stata List I am trying to include a line break in a variable label, but cannot quite make it work as I...
Read more >Line break in X-axis column label? - Excel Help Forum
I have a chart with the data shown in columns. I am trying to format my data column in the worksheet so the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just adding my voice to needing this. I’m not sure about your categorization of uncommon @bryevdv.
A thought / motivating example. May or may not be helpful.
I’m working with a lot of categorical, long-name data at the moment. One of the more frustrating aspects of plotting it with bokeh is that I need to constantly be fiddling with the plot height to get my labels spaced out sufficiently so I can read them.
In the case of categorical labels I would argue that you definitely want to see all the labels (it’s not like linear / numeric axes where you can just put in labels as convenient). So it’s a case where you want the plot to grow (typically in height because it’s far easier to read labels that are oriented on a y-axis) based on the number of factors you have and the desired spacing.
I know the layout engine has been overhauled since I worked on it, so maybe it’s more flexible now. Certainly when I worked on it, I would not have wanted to deal with plot height being set like this.
But I just wanted to throw this out there as a motivating example.
I would also be happy with a non-plotting-api solution. That is, I have to explicitly setup my SelfSizingAxis/Range. Because this would still be more convenient than iterating plot heights.