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.

Does altair have redim-like or xlab/ylab-like functionality?

I know it’s possible to set axis titles via alt.Axis(title='NEW TITLE'), but I’m wondering if it’s possible to do this in an alternate way, say if the chart object has already been created, but one just wants to modify the axis labels. For example in ggplot:

p <- ggplot(df) +
    geom_point(aes(x, y))
p

# "curious plot, i wonder what it looks like with axis titles"
p +
    xlab("interesting axis 1") +
    ylab("interesting axis 2")

Issue Analytics

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

github_iconTop GitHub Comments

7reactions
jakevdpcommented, Jun 11, 2018

You could do something like this:

chart = alt.Chart(data).encode(
    alt.X('foo'),
    alt.Y('bar')
)

chart.encoding.x.title = 'new title'
chart.encoding.y.title = 'another new title'
0reactions
jakevdpcommented, Oct 18, 2019

Yes, for example:

chart = alt.Chart(data).encode(
    alt.X('foo', title='Foo', axis=alt.Axis(titleFont="Helvetica Neue"))
)

more axis properties can be seen at https://altair-viz.github.io/user_guide/generated/core/altair.Axis.html

Read more comments on GitHub >

github_iconTop Results From Across the Web

pandas.DataFrame.rename_axis
The axis to rename. For Series this parameter is unused and defaults to 0. copybool, default True. Also copy underlying data. inplacebool, default...
Read more >
Change axis labels in a chart - Microsoft Support
Right-click the category axis and Select Data. In the Horizontal (Category) Axis Labels box, click Edit. In the Axis label range box, enter...
Read more >
Axes and Text - Quick-R
Improve your graphs in R with titles, text annotations, labelling of points, minor tick marks, reference lines, custom axes, and a chart legend....
Read more >
About Axis Labels
About Axis Labels. Axis labels are text that mark major divisions on a chart. Category axis labels show category names; value axis labels...
Read more >
Modify axis, legend, and plot labels — labs • ggplot2
Always ensure the axis and legend labels display the full variable name. ... label. The title of the respective axis (for xlab() or...
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