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

Altair support #1

Open
jedbrown opened this issue Sep 20, 2020 · 5 comments
Open

Altair support #1

jedbrown opened this issue Sep 20, 2020 · 5 comments

Comments

@jedbrown
Copy link

Altair is a 2D plotting library based on grammar of graphics (like R's ggplot2), typically producing Vega-Lite output (for interactive web output). Static figures can also be saved as PDF or SVG using altair_saver. If you're willing to abstract matplotlib in rsmf, it seems it would be feasible to also support Altair, which would enable use of the same plotting platform for interactive figures in HTML talks as well as PDF figures in static papers.

@johannesjmeyer
Copy link
Owner

I agree that it seems feasible. But I first have to understand a few things:

  • The purpose of rsmf is to format figures for use with LaTeX. To obtain the same optics, the pgf backend of matplotlib is used which is essentially rendering the figure through LaTeX, ensuring coherent optics. Does Altair have a similar, LaTeX-compatible backend? If not, ensuring the correct fonts are used will be super hackish.
  • HTML talks are somewhat out of scope for rsmf, as it is built to pull the information of how to setup the PGF backend from TeX. So I don't see how rsmf would bring a benefit there?

@jedbrown
Copy link
Author

There is no analog to matplotlib's pgf backend. @jakevdp may have thoughts on how difficult it would be to teach Altair to save using PGF or similar.

I didn't mean to imply that rsmf would be used for HTML plots. Rather, that a single visualization would be created using Altair to be used in talks/websites, and use rsmf to help make the fonts paper-friendly. My present workflow has been to either live with font mismatch or to recreate a similar figure using matplotlib, but that requires remembering (and teaching or expecting students to learn) two disparate plotting interfaces.

@jakevdp
Copy link

jakevdp commented Sep 21, 2020

The vega-cli package has methods to save vega/vega-lite charts to png, svg, and pdf. If none of those are suitable for the purposes here, that package would be the place to implement other formats.

@jedbrown
Copy link
Author

It seems like all the existing outputs in vega-cli go through Vega's renderHeadless() so we'd be looking for JavaScript libraries that output pgf/latex. My search didn't turn up much, but I'm very unfamiliar with the JS ecosystem.

@johannesjmeyer
Copy link
Owner

Okay, but from this vantage point it looks like supporting vega would first require some changes on the vega side. I think the important features to add to rsmf before this can be addressed are additional journal venues. So I'd postpone a possible vega integration.

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

No branches or pull requests

3 participants