[Feature Request] Simplify saving to PNG
See original GitHub issueAs a new user looking for better grammar and control than pandas and matplotlib, this has been my adoption experience with Altair:
- Great documentation, able to start plotting right away.
- Support for faceting; nice, I will commit to learning this “language”.
- Go to save to PNG.
- Need other pip package
altair_saver
; install it. - Need
geckodriver
from package manager; install it. - Got chromedriver error and had to search outside documentation for solution.
- Even after sorting that, encountered deprecation error.
Problem is I need two dependencies for it to do something I would expect it to
support natively: save as PNG. These two dependencies are not able to be tracked
as dependencies as far as I know, meaning if I pip uninstall altair
I’d like
it to take altair_saver
and geckodriver
with it. I would accept needing just
altair
and altair_saver
from pip.
Further, once I got the dependencies sorted, I had to search outside the
instructions to learn that if I’m using geckodriver
I need to call save with
save(..., webdriver="firefox")
.
Even after overcoming that, I got hit with an error due to a recent selenium upgrade with breaking dependencies, as noted in this issue.
Sure if I’m making one plot, it’s not too bad to output .html, view it in firefox, and save to PNG using the dot menu. The problem is it’s never just one plot. I usually have a program that analyzes my dataframe and generates many plots which I’d like to name then and there based on what I’m doing then and there in the program.
A potential solution would be providing an Altair package or script, or linking to an existing pip package that lets me output a directory of .html plots, and convert them all to .png, preserving the basenames.
Best case scenario: chart.save("to.png")
just works.
I’m taking the time to write this to improve this otherwise powerful, promising tool, and possibly, adoption thereof. I turned away from Altair simply because the hurdle to save to PNG was disproportionately and unexpectedly large. I came back because pandas and matplotlib is too restricting and indirect, and the stifling of this became significantly clearer after my brief work with Altair. It’s worth noting I also tried plotnine in my search, and I found Altair’s documentation to be better, and syntax to be much more direct. Altair had more pleasing default colors and conveniently used labeling from the df, without intervention.
Issue Analytics
- State:
- Created a year ago
- Comments:32 (9 by maintainers)
Top GitHub Comments
Update: New release has some additional wheels (linux-glibc, win-x64, and macos-x64) folks can try locally, also fixed the issue with windows.
Thanks for the kind words on
vl-convert
@daylinmorgan, and for your work onokab
.This would be my preference, and I’d be happy to work on a PR for this soon