Browse Source

add png visualization in ipython notebook

Add a _repr_png_ method to ghost to give a png preview of plots in the
notebook.
pull/15/head
Ali Ebrahim 12 years ago
parent
commit
17ec8971a3
  1. 4
      pygal/ghost.py

4
pygal/ghost.py

@ -102,3 +102,7 @@ class Ghost(object):
"""Render the graph, convert it to png and write it to filename"""
import cairosvg
return cairosvg.svg2png(bytestring=self.render(), write_to=filename)
def _repr_png_(self):
"""Display png in IPython notebook"""
return self.render_to_png()

Loading…
Cancel
Save