Altair: How to set a multiline title for an axis or legend?

Created on 9 Nov 2016  路  8Comments  路  Source: altair-viz/altair

Passing a string with '\n' in it doesn't seem to work

vega-lite-related

Most helpful comment

For anyone revisiting this, Vega now supports this multiline functionality. Just pass in a list of strings as the title:

axis=alt.Axis(title=['Text on the first line', 'and text on the second line'])

All 8 comments

I don't believe this is allowed currently in Vega-Lite.

Yep. This is currently not supported in Vega-Lite due to lack of support for this Vega.
But there is a feature request in Vega. https://github.com/vega/vega/issues/488.

Closing as vega-lite-related.

Sorry to comment on a closed issue, but could someone clarify how vega-lite-related issues work? I understand it needs to be implemented in Vega-lite first, but will it "automatically" work if it's implemented there or is there a delay while Altair features catch up ? It seems there isn't much hope of waiting for it to be implemented in Vega-lite...issue 488 seems pretty inactive.

This functionality is pretty essential (in my opinion) and I'm trying to figure out whether a PR to "hack this functionality" in Altair would be supported (assuming I can figure out how to do it).

"vega-lite related" generally means there is no change you could make to the Altair codebase that would address the issue.

ah okay. thanks then

Can we reopen this? Looks like vega-lite will support this but requres passing a string array instead of a string.

For anyone revisiting this, Vega now supports this multiline functionality. Just pass in a list of strings as the title:

axis=alt.Axis(title=['Text on the first line', 'and text on the second line'])

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tonylee3399 picture tonylee3399  路  3Comments

LukeMathWalker picture LukeMathWalker  路  3Comments

bmcfee picture bmcfee  路  3Comments

nielsmde picture nielsmde  路  4Comments

maxgerma picture maxgerma  路  3Comments