Skip to content

Commit

Permalink
added IPython rich display to Figure class
Browse files Browse the repository at this point in the history
  • Loading branch information
btel committed Jan 23, 2018
1 parent 71bc73a commit d909b5b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/svgutils/compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,15 @@ def save(self, fname):
element.save(os.path.join(CONFIG['figure.save_path'], fname))

def tostr(self):
"""Export SVG as string"""
"""Export SVG as a string"""
element = _transform.SVGFigure(self.width, self.height)
element.append(self)
svgstr = element.to_str()
return svgstr

def _repr_svg_(self):
return self.tostr().decode('ascii')

def tile(self, ncols, nrows):
"""Automatically tile the panels of the figure.
Expand Down

0 comments on commit d909b5b

Please sign in to comment.