-
Notifications
You must be signed in to change notification settings - Fork 796
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
configure_axisX(title='foo') removes x-axis title #3582
Comments
@MarcoGorelli to get the result you're after, the Solution# NOTE: Original
# chart = (
# alt.Chart(pl.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]}))
# .mark_line()
# .encode(x="a", y="b")
# .configure_axisX(title="foo")
# )
# NOTE: Fixed
chart = (
alt.Chart(pl.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]}))
.mark_line()
.encode(x=alt.X("a").title("foo"), y="b")
)
chart You can check where this ends up in the spec with Original{'config': {'view': {'continuousWidth': 300, 'continuousHeight': 300},
'axisX': {'title': 'foo'}}, # <-----------------------
'data': {'name': 'data-be85e675f9b8f0270cc9ebf085a7356c'},
'mark': {'type': 'line'},
'encoding': {'x': {'field': 'a', 'type': 'quantitative'},
'y': {'field': 'b', 'type': 'quantitative'}},
'$schema': 'https://vega.github.io/schema/vega-lite/v5.20.1.json',
'datasets': {'data-be85e675f9b8f0270cc9ebf085a7356c': [{'a': 1, 'b': 4},
{'a': 2, 'b': 5},
{'a': 3, 'b': 6}]}} Fixed{'config': {'view': {'continuousWidth': 300, 'continuousHeight': 300}},
'data': {'name': 'data-be85e675f9b8f0270cc9ebf085a7356c'},
'mark': {'type': 'line'},
'encoding': {'x': {'field': 'a', 'title': 'foo', 'type': 'quantitative'}, # <-----------------------
'y': {'field': 'b', 'type': 'quantitative'}},
'$schema': 'https://vega.github.io/schema/vega-lite/v5.20.1.json',
'datasets': {'data-be85e675f9b8f0270cc9ebf085a7356c': [{'a': 1, 'b': 4},
{'a': 2, 'b': 5},
{'a': 3, 'b': 6}]}} More Info |
ah, thanks @dangotbanned ! 🙏 closing then |
@mattijn I'm not sure what it looks like in your IDE - but IIRC there are some screenshots in here showing VSCode #3515 |
thanks for your inputs - yup |
@dangotbanned, I did attach a screenshot of how it looks like in my IDE, which is JupyterLab. As far as I understand, there is not such a thing as on hover in the tooltip / signature-help that I activated by pressing shift+tab upon entering the function. @MarcoGorelli, my mental model is currently favouring something like, everything related to Edit: it can be named differently. |
Apologies @mattijn what I meant was that I wasn't sure what would be displayed if you hovered over the From a quick search, it seems you might need something like this https://github.com/jupyter-lsp/jupyterlab-lsp Although @MarcoGorelli @binste if you have any experience with Jupyterlab - maybe you'd have a better suggestion? EditThis would be the equivalent for VSCode https://github.com/microsoft/pylance-release |
Yup I'd also prefer this, I'm just thinking about discoverability for people just using It's hard to say where to draw the line 🤔 will sleep on it some more |
I'm going to reopen this, since I think we should either support |
Yeah, One more thing to add, colors and color schemes is also something that people like to control often. Which could be done as such: import polars as pl
import altair as alt
path = "https://raw.githubusercontent.com/pola-rs/polars/main/docs/data/iris.csv"
df = pl.read_csv(path)
df.plot.scatter(
x='petal_length',
y='petal_width',
color=alt.Color('sepal_length').scale(scheme="lightgreyred")
) But with some more sleep and showers (🙌) we might come up with a more polars-centric approach. |
@joelostblom These are the specs for each chart from #3582 (comment) I will admit it is odd that setting a default value for the axis results in its removal; but this is consistent with |
Raised in VL vega/vega-lite#9429 |
Thank you @mattijn, closing this one then. |
What happened?
I ran
and got
What would you like to happen instead?
Which version of Altair are you using?
5.4.1
The text was updated successfully, but these errors were encountered: