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

Broken Example Gallery #2291

Closed
domsl opened this issue Sep 16, 2020 · 6 comments
Closed

Broken Example Gallery #2291

domsl opened this issue Sep 16, 2020 · 6 comments

Comments

@domsl
Copy link

domsl commented Sep 16, 2020

Hey, I love the example gallery of the docs a lot, because I always get confused which objects goes where after reading API, so the examples really help me grasp altair.
(Something like this aready confuses me alot :)

So I found several broken examples:

https://altair-viz.github.io/gallery/simple_histogram.html
https://altair-viz.github.io/gallery/cumulative_count_chart.html
https://altair-viz.github.io/gallery/binned_scatterplot.html
https://altair-viz.github.io/gallery/stripplot.html
https://altair-viz.github.io/gallery/histogram_with_a_global_mean_overlay.html
https://altair-viz.github.io/gallery/interactive_cross_highlight.html
https://altair-viz.github.io/gallery/multiple_interactions.html

(I stopped searching after the interactive ones.)

I tried searching for an issue that already reports that, but I did not find anything.

I do not know how to fix it unfortunately.

@jakevdp
Copy link
Collaborator

jakevdp commented Sep 16, 2020

Sorry about that - this has been an issue for a couple months due to vega-datasets changing all their URLs, and I haven't had a chance to fix it.

@rlguarino
Copy link

rlguarino commented Sep 23, 2020

I think some of the broken dashboards are because the Vegas datasets switched from underscore separated column names to space separated in vega/vega@8b16c45

I was able to fix some of the examples by updating the column names in the Vega editor: Open the Chart in the Vega Editor

I was going to send a find and replace CL for the chats that depend on the movie but I'm not sure if it will be right.
I started with IMDB Rating but reached the depth of my knowledge.
For example, how would I update the following code to have spaces instead of underscores?

https://github.com/altair-viz/altair/blob/4f6dd28b3d8d540533d59ad1b638f4da8480b87e/altair/examples/multiple_interactions.py#L26-L38

Is it valid to replace all of the dot accesses datum.IMDB_Rating with datum['IMDB Rating'] ?

@mattijn
Copy link
Contributor

mattijn commented Sep 23, 2020

Yes. As is documented here https://vega.github.io/vega/docs/expressions/#datum

@mattlangeman
Copy link

I ran into similar issues while going through the uwdata visualization curriculum. As @rlguarino mentions, the movie dataset changed column names from underscore separated to space separated. This also required changing a bunch of datum.column_names to datum['column names'] and doing things with double quotes as below

alt.Chart(movies).mark_area().transform_calculate(
    NonUS_Gross="datum['Worldwide Gross'] - datum['US Gross']"
).encode(
    alt.X('month(Release Date):T'),
    alt.Y('median(NonUS_Gross):Q')
)

You can see an example of these changes in altair_data_transformation.ipynb

Note: I haven't figured out how to get my output cells to have embedded pngs, but the output looks good when I run it locally.

I am a bit new to the altair and vega communities, but would be happy to help with this if I can be useful.

@joelostblom
Copy link
Contributor

joelostblom commented Oct 6, 2020

@jakevdp @rlguarino I believe a fix to the docs has already been suggested in this PR #2241

@joelostblom
Copy link
Contributor

This was fixed in the 4.2 release and the examples linked above are now working.

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

No branches or pull requests

6 participants