Reputation: 3614
When trying to export an Altair chart in SVG format from a Jupyter Notebook running inside Visual Studio Code, I am prompted "You'll need a new app to open this data link", but no apps are listed for handling "data" links (inc in the Microsoft Store).
No issues exporting a chart in PNG format, or exporting in SVG format when running in a browser window. Not sure whom to blame: Altair, Vega, Jupyter, or Microsoft...
Upvotes: 3
Views: 1007
Reputation: 3614
Looks like this bug was fixed in the latest version of the Jupyter VSCode extension!
Upvotes: 0
Reputation: 75
Github issue : Unable to save SVG of altair chart in vs-code Jupyter .
Altair can do this via the altair_saver package, which can be installed with:
conda install altair_saver
or
pip install altair_saver
Additional Requirements for altair_saver package : one of two backends. {Selenium / Nodejs }
Detailed Instructions for installation of Additional Requirements
To save an Altair chart object as a SVG image, you can use
alt.renderers.enable('altair_saver', fmts=['vega-lite', 'png'])
Chart.save("chart.svg")
Upvotes: 2