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.

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.

Issue Analytics

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

github_iconTop GitHub Comments

6reactions
Alcampopianocommented, Jul 23, 2018

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.

1reaction
mroswellcommented, Jul 3, 2021

I’m returning to this same chart four years later (a surprise when I was Googling for answers to come upon my own original question). I figured out a few updates, wanting to update the x label, and keep the wider Y-axis label.

I replaced this code:

Chart(grantor).mark_bar() \
.encode(y=Y('index:N', sort=SortField(field='Name', order='ascending'),
        axis=Axis(title='Grant Program')), x='Name:Q') \
.configure_axis(tickLabelFontSize=12, labelMaxLength=300)

With this, for the win:

Chart(grantor).mark_bar() \
.encode(y=Y('index:N', sort=SortField(field='Name', order='descending'),
        axis=Axis(title='Grant Program')), x=X('Name:Q', title='Number of Grants')) \
.configure_axis(labelLimit=400)

(Not sure why I had to change the order to descending, but it worked.)

UPDATE: Oh, but now the ‘Grant Program’ Y axes label is sitting on top of the grant program names. Back to the drawing board.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I control the width of a label tag? - Stack Overflow
Inline elements (like SPAN, LABEL, etc.) are displayed so that their height and width are calculated by the browser based on their content....
Read more >
How to Control the Width of the <label> Tag - W3docs
Since the tag is an inline element, using the width property won't have any effect. Here you can find some methods of adding...
Read more >
Understanding Label Dimensions - Print.Save.Repeat.
Label Width : A label's width is the distance between each side of the label. Outer Diameter: The Outer Diameter of a label...
Read more >
label width: 100px; : label « Form « HTML / CSS - Java2s.com
label width : 100px; : label « Form « HTML / CSS.
Read more >
How to add Label width in Tkinter? - Tutorialspoint
The size of the label widget depends on a number of factors such as width, height, and Font-size of the Label text. 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