altair icon indicating copy to clipboard operation
altair copied to clipboard

Adding 2 examples on using custom svg shapes

Open armsp opened this issue 4 years ago • 4 comments

Last year I was able to get some cool graphs using custom SVG shapes with @jakevdp 's help. I eventually ended up emulating a lot of cool graphs and put them on my project website: https://armsp.github.io/covidviz/

This is a PR that adds simplified examples of just the maps with custom SVG markers.

Example 1: custom_svg_mark_geospatial.py

This example shows how to use custom SVG shapes as marks on Geospatial plots.

Since the data for this plot is not available in vega-datasets, you'd have to download the data hosted on my personal repo - https://github.com/armsp/datasets/blob/master/covid_cases_april_6.csv

Example 2: interactive_time_series_geospatial_chart.py

This example shows how to use range slider that lets you choose a day which is used by the selection to select data only for that day to visualize surge in per-capita cases of covid-19. The marks are custom SVG shapes (a vertical line) on a geospatial plot (it looks like a bar plot on a map). Slide the slider knob to see how the selection changes the data and hence the plot.

Since the data for this plot is not available in vega-datasets, you'd have to download the data hosted on my personal repo - https://github.com/armsp/datasets/blob/master/past_2_weeks_per_capita.csv

Some Issues

There are some guidelines on things to take care of when adding examples. Unfortunately I have broken a few of them. I do not know the best way to fix them. So I am hoping that the maintainers would guide me on the best possible way to fix them so that the PR is in a state that can be merged for the next release cycle.

Things I believe I have not followed -

  1. The data for the states base layer is requested from the CDN providers for us-atlas project : external calls to data
  2. The data for plots is hosted on my personal repo : external calls to data
  3. I am not sure of the category of the first plot - maps OR other charts

armsp avatar Apr 10 '21 05:04 armsp

Maintainers, do you have any suggestions for how to replace the external data sources, or will you be willing to add new datasets?

This is how the graphs look -

  1. custom_svg_mark_geospatial.py custom_svg

  2. interactive_time_series_geospatial_chart.py custom_svg_ts

armsp avatar Apr 13 '21 05:04 armsp

Thanks for this PR @armsp. I like the visz on your project website: https://armsp.github.io/covidviz/, but I do feel that this PR is a bit complex, contains similar information to the existing isotype example: https://altair-viz.github.io/gallery/isotype_grid.html and is dependent on external data outside vega_datasets.

Therefor I'm tempted to say to not accept this PR for the documentation. Let me leave it open for a bit if others are opinionated differently.

mattijn avatar Dec 27 '22 21:12 mattijn

I am on the edge with this one, but think I agree with you @mattijn. Especially the calls to external data sources is problematic and makes this a better fit for https://github.com/altair-viz/altair/issues/2697 in my opinion. I think the viz is cool and it would be great to mention a short description with a link in that issue @armsp so that it can be showcased once we add this new page to the docs.

joelostblom avatar Jan 03 '23 11:01 joelostblom

Thanks for this PR @armsp. I like the visz on your project website: https://armsp.github.io/covidviz/, but I do feel that this PR is a bit complex, contains similar information to the existing isotype example: https://altair-viz.github.io/gallery/isotype_grid.html and is dependent on external data outside vega_datasets.

Therefor I'm tempted to say to not accept this PR for the documentation. Let me leave it open for a bit if others are opinionated differently.

I understand...I just think that covid viz kind of became ubiquitous and will be so for years to come...especially when teaching visualizations because they provide so many different ways to viz essentially the same phenomenon. It kind of makes sense to add those datasets in vega-lite. And perhaps update the map base layer, or if I am not wrong then maybe I could just use the base layer provided by vega which IMO is not as aesthetically pleasing as what I have used.

armsp avatar Jan 03 '23 11:01 armsp