File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -661,11 +661,11 @@ or by saving to a file handle::
661661 fig.savefig(sys.stdout)
662662
663663Here is an example using `Pillow <http://python-imaging.github.io/ >`_.
664- First, the figure is saved to a StringIO object which is then fed to
664+ First, the figure is saved to a BytesIO object which is then fed to
665665Pillow for further processing::
666666
667667 from io import BytesIO
668- import Image
668+ from PIL import Image
669669 imgdata = BytesIO()
670670 fig.savefig(imgdata, format='png')
671671 imgdata.seek(0) # rewind the data
Original file line number Diff line number Diff line change 5151ax .set_xlim (0. , 1. )
5252ax .set_ylim (0. , 1. )
5353
54- # save the figure as a string in the svg format.
54+ # save the figure as a bytes string in the svg format.
5555from io import BytesIO
5656f = BytesIO ()
5757plt .savefig (f , format = "svg" )
You can’t perform that action at this time.
0 commit comments