Monday, 24 April 2017

saving figures in python altair

I am trying to save altair figures in html any graphic format (png, eps).

  • HTML. The figures in html are not displayed. A blank page

  • PNG. The documentations says I need canvas package and provides a command how to install it for conda. I don't have conda. I am installing it system-wide with npm install canvas.

When calling `chart.savechart(filetype="eps", outfile="ex1"), I am getting:

NameError                                 Traceback (most recent call last)
<ipython-input-9-7cc84e0f0694> in <module>()
----> 1 chart.savechart(filetype="eps", outfile="occupancy_vs_epoch")

/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/altair/api.py in savechart(self, outfile, filetype)
    180                     f.write(self.to_html())
    181         else:
--> 182             supported = _node.SUPPORTED_FILETYPES + ['json', 'html']
    183             raise ValueError('Cannot save chart of type {0}; supported'
    184                              'extensions are {1}'.format(filetype, supported))

NameError: name '_node' is not defined

Any idea how to debug these two bummers?



via Dima Lituiev

No comments:

Post a Comment