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 or word wrap for labels in axis

See original GitHub issue

Hi, I have a short question. Why does not working the line break or word wrap for labels in axis like: vega-lite-line-break-or-word-wrap-for-labels-in-axis?

chart = alt.Chart(data).mark_bar().transform_calculate(
        address="split(datum.address, ' ')"
 ).encode(...)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
tzipperlecommented, Dec 30, 2020

Thanks for the explanation. And sorry for the missing example. Is there a plan for a new Altair release?

1reaction
joelostblomcommented, Feb 23, 2022

@qunderriner Your example is working as expected for me. Make sure you are on the latest version of Altair (4.2.0).

@tzipperle Your facet example is also working in 4.2.0, so I am going to close this issue.

For anyone else finding this and looking for ways to wrap labels at word boundaries of specific lengths rather than manually creating a list, you can use the textwrap package as described here https://stackoverflow.com/questions/71215156/how-to-wrap-axis-label-in-altair

image

and

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vega-lite: Line break or word wrap for labels in axis
So is there any way to achieve it. I tried using calculate and labelExpr by breaking the label string and then concatenating them...
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 >
How to wrap X axis labels in a chart in Excel? - ExtendOffice
And you can do as follows: 1. Double click a label cell, and put the cursor at the place where you will break...
Read more >
Text wrapping for x-axis chart labels - Microsoft Community
I have a graph in Word where the labels are getting cut off: I'd like to be able to wrap the text, but...
Read more >
How to Wrap Chart Axis Text in Excel - YouTube
... chart axis labels ? It doesn't exist…but this secret hack makes it happen so learn this neat little trick to wrap text...
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