File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -661,11 +661,11 @@ or by saving to a file handle::
661
661
fig.savefig(sys.stdout)
662
662
663
663
Here 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
665
665
Pillow for further processing::
666
666
667
667
from io import BytesIO
668
- import Image
668
+ from PIL import Image
669
669
imgdata = BytesIO()
670
670
fig.savefig(imgdata, format='png')
671
671
imgdata.seek(0) # rewind the data
Original file line number Diff line number Diff line change 51
51
ax .set_xlim (0. , 1. )
52
52
ax .set_ylim (0. , 1. )
53
53
54
- # save the figure as a string in the svg format.
54
+ # save the figure as a bytes string in the svg format.
55
55
from io import BytesIO
56
56
f = BytesIO ()
57
57
plt .savefig (f , format = "svg" )
You can’t perform that action at this time.
0 commit comments