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

Add programmatic export utility based on selenium and chrome-headless #554

Merged
merged 3 commits into from
Mar 5, 2018

Conversation

jakevdp
Copy link
Collaborator

@jakevdp jakevdp commented Mar 5, 2018

This allows you to save altair charts to PNG without going to the browser.

Dependencies can be installed this way:

$ conda install selenium PIL
$ conda install -c clinicalgraphics chromedriver

Then you can use the utility this way:

import alt
chart = alt.Chart(...)  # make your favorite chart here

from altair.utils import save_spec
save_spec(chart.to_dict(), 'mychart.png')

Eventually we can make this more streamlined for the user (e.g. chart.save('mychart.png')) but we'll have to figure out the dependency story... and I wanted to get the initial version of this utility committed so that I can use it to build docs for the release candidate.

@jakevdp
Copy link
Collaborator Author

jakevdp commented Mar 5, 2018

This clearly could use some improvements, but I'm going to merge so that I can incorporate it into #552 and get the doc build working.

@jakevdp jakevdp merged commit f65cf16 into vega:master Mar 5, 2018
@jakevdp jakevdp deleted the selenium branch March 5, 2018 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant