Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cancelling the 0.5s on x-axis #1655

Closed
JinjinJanelle opened this issue Aug 12, 2019 · 5 comments
Closed

Cancelling the 0.5s on x-axis #1655

JinjinJanelle opened this issue Aug 12, 2019 · 5 comments
Labels

Comments

@JinjinJanelle
Copy link

Altair automatically added float numbers on the axis between the whole numbers. Is there a way to cancel it?
Thank you!
Screen Shot 2019-08-12 at 10 24 56 AM

@jakevdp
Copy link
Collaborator

jakevdp commented Aug 12, 2019

You can set the tickMinStep property of the axis. For example:

import altair as alt
import pandas as pd

df = pd.DataFrame({
    'x': range(5),
    'y': range(5)
})

alt.Chart(df).mark_point().encode(
    alt.X('x', axis=alt.Axis(tickMinStep=1.0)),
    alt.Y('y')
)

visualization (1)

@JinjinJanelle
Copy link
Author

Thank you! This is very useful!

@morberg
Copy link
Contributor

morberg commented Oct 29, 2020

In Altair 4.1.0 the gridlines still remain, although the ticks are no longer shown. Is this a bug? I would expect the gridlines to disappear as well as in your screenshot.

image

@aurimas-ww
Copy link

It appears that tickMinStep no longer works in Altair 5.0.1 - the example from @jakevdp now produces a chart with 0.5 tick labels, too. Is there a different solution for this now? From what I can see, the tickMinStep parameter is still valid in Altair 5.

@zizaozi
Copy link

zizaozi commented Nov 10, 2023

Using tickCount instead in jakevdp's example works for me
alt.X('x', axis=alt.Axis(tickCount=len(df)))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants