question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error saving to SVG

See original GitHub issue

Hi. Using the first example in the docs

from altair import Chart, load_dataset

# load built-in dataset as a pandas DataFrame
cars = load_dataset('cars')

chart = Chart(cars).mark_circle().encode(
    x='Horsepower',
    y='Miles_per_Gallon',
    color='Origin',
)

the following attempt to save to SVG fails

chart.savechart('cars.jpg','jpg')
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2881, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-14-b070806b7bcc>", line 1, in <module>
    chart.savechart('cars.jpg','jpg')
  File "/usr/local/lib/python2.7/site-packages/altair/api.py", line 182, in savechart
    supported = _node.SUPPORTED_FILETYPES + ['json', 'html']
NameError: global name '_node' is not defined

and attempting to use vl2svg directly gives the error

vl2svg cars.json cars.jpg
/usr/local/lib/node_modules/vega/build/vega.js:686
  throw Error(message);
  ^

Error: Missing required "filter" parameter: "expr"
    at error (/usr/local/lib/node_modules/vega/build/vega.js:686:9)
    at parseParameter$1 (/usr/local/lib/node_modules/vega/build/vega.js:28796:9)
    at parseParameters (/usr/local/lib/node_modules/vega/build/vega.js:28775:25)
    at parseTransform (/usr/local/lib/node_modules/vega/build/vega.js:28763:35)
    at /usr/local/lib/node_modules/vega/build/vega.js:29639:23
    at Array.forEach (native)
    at parseData$1 (/usr/local/lib/node_modules/vega/build/vega.js:29638:20)
    at /usr/local/lib/node_modules/vega/build/vega.js:30045:5
    at Array.forEach (native)
    at parseSpec (/usr/local/lib/node_modules/vega/build/vega.js:30044:22)

I have installed canvas, vega and vega-lite and altair is the pypi version.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jakevdpcommented, May 17, 2018

This is no longer relevant, because Altair 2 uses selenium rather than node for programmatic export.

1reaction
jakevdpcommented, Sep 27, 2017

For what it’s worth, I can no longer get this to work on any of my machines. I think the NodeJS+shell dependency is something we’re going to have to figure out how to move away from (Bokeh has an interesting approach that we may adopt)

Read more comments on GitHub >

github_iconTop Results From Across the Web

SVG export error - Software - Graphic Design Forum
If you are missing SVG format from Export as option after the Photoshop 22.5 update then, go to Photoshop > Preferences > Export...
Read more >
Error while saving type as SVG - Adobe Support Community
I'm trying to save several typographic designs as SVG, type as SVG not outline. For some files it works perfectly, with others I...
Read more >
Silhouette Studio Save as SVG Export Errors (And How to Fix ...
If your design is not saving as an SVG, but is instead exporting as a Studio file, it's likely because the file type...
Read more >
Why text in exported SVG images may not display correctly
When you export a diagram as a SVG image ( File > Export as > SVG ), choose which Text Settings you want...
Read more >
Powerpoint on Windows 7 - unable to save a file as an SVG ...
Replies (12) · 1. Check whether PowerPoint has updated to the latest version. · 2. Try to open PowerPoint in safe mode. ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found