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

Log scale bar chart renders correct chart, but not working generated vega-spec #3447

Open
mscolnick opened this issue Jun 27, 2024 · 1 comment
Labels

Comments

@mscolnick
Copy link

mscolnick commented Jun 27, 2024

What happened?

I have this altair code that produces a working chart, but the generate vega-lite spec does not render correctly.

For example, here is a reproduction: https://marimo.app/l/nhwpi8

import altair as alt
import pandas as pd
data = {"x": range(1, 11), "y": [5, 10, 2, 8, 3, 15, 1, 4, 9, 6]}
df = pd.DataFrame(data)

(
    alt.Chart(df)
    .mark_bar(stroke="black", strokeWidth=0.5)
    .encode(
        x=alt.X(
            "x",
        ),
        y=alt.Y(
            "y",
            scale=alt.Scale(type="log"),
        ),
    )
)
image

But the produced vega playground, that can be found here, does not render properly with log scale.

I have filed an issue on vega-lite, but this seems to be downstream: vega/vega-lite#9373

What would you like to happen instead?

The produced vega-lite code matches the rendered chart.

Which version of Altair are you using?

5.3.0

@mattijn
Copy link
Contributor

mattijn commented Jun 27, 2024

Thanks for raising!
The latest version of Altair compiles to Vega-lite 5.17, but the latest Vega-lite version is 5.19.
So this behavior might be a potential regression introduced in VL version 5.18 or 5.19. I say potential, because I'm not sure if it was intentional.

Personally, I'm fine with a default for log-scales (1 it seems), just as linear-scales have a default (0).

It is something we need to be aware of when upgrading, but it is not something we control.

So your current issue at the VL repository is the appropriate place to raise this issue.

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

2 participants