question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Line break in categorical axis labels

See original GitHub issue

Feature 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)

image

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
birdsarahcommented, Sep 19, 2018

Just adding my voice to needing this. I’m not sure about your categorization of uncommon @bryevdv.

0reactions
birdsarahcommented, Sep 20, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found