marimo-team / marimo

A reactive notebook for Python — run reproducible experiments, execute as a script, deploy as an app, and version with git.

Home Page:https://marimo.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Save altair charts as pdf

michaelsch71 opened this issue · comments

Description

I am hoping to be able to save altair charts as pdf from the burger menu of the displayed chart. Right now "Save as SVG" and "Save as PNG" are already available. Still it would be great to save as pdf also, which is one of the most popular formats to save graphics in a vector format.

Suggested solution

Add a "Save as PDF" version to the burger menu. Altair already has the option to save as pdf internally, by just calling chart.save("filename.pdf"). So I hope this can be used to add the requested feature

Alternative

No response

Additional context

No response

@michaelsch71 - we welcome the contribution if you'd like to add support for this.

if you don't want to (that's ok!), you can roll this yourself pretty easily with mo.ui.button and following https://altair-viz.github.io/user_guide/saving_charts.html#png-svg-and-pdf-format

you could even pull this out to its own file and import it into your notebook if you'd like to re-use it across multiple notebooks.