Altair: label width

Created on 5 Aug 2017  路  4Comments  路  Source: altair-viz/altair

I haven't figured out how to get my labels to fully print out. I've explored the altair documentation, the vega documentation, and the d3 documentation
counts

https://github.com/d3/d3-format/blob/master/README.md#format
says:
"If not specified, then the width will be determined by the content."
So I guess my content is ellipsed? But the grantor dataframe definitely has every grant program name fully spelled-out.

grantor = pd.DataFrame(df['Name'].value_counts())
grantor.reset_index(inplace=True)
Chart(grantor).mark_bar().encode(y=Y('index', sort=SortField(field='Name', order='ascending'),
        axis=Axis(title='Grant Program')), x='Name')

BTW, the oddball "Name" in the X axis is because I converted a series into value_counts which retained the "Name" name for the count column name.

Most helpful comment

I wasn't able to find labelMaxLength as a possible option. However, .configure_axis(labelLimit=1000) seemed to work. Not sure what the recommended method is.

All 4 comments

I finally found it!
.configure_axis(labelMaxLength=300)

I kept looking for words like "length" and "padding" and "margin"

So glad!

I wasn't able to find labelMaxLength as a possible option. However, .configure_axis(labelLimit=1000) seemed to work. Not sure what the recommended method is.

I think that labelMaxLength was the available property in Altair 1.0. and labelLimit is the available property in Altair 2.0.

Awesome. Thanks Jake.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

galloramiro picture galloramiro  路  3Comments

floringogianu picture floringogianu  路  3Comments

tonylee3399 picture tonylee3399  路  3Comments

fischcheng picture fischcheng  路  4Comments

HalukaMB picture HalukaMB  路  3Comments