Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np;
- import matplotlib as mpl;
- mpl.use("Agg");
- import matplotlib.pyplot as plt;
- my_array = np.random.randint(0,100,1000,dtype=int);
- fig1 = plt.figure(1, figsize=(20,10));
- n, bins, patches = plt.hist(my_array, bins="auto", normed=1, facecolor="blue",alpha=0.8);
- plt.ylabel("Freq",fontsize=30);
- plt.xlabel("X",fontsize=30);
- plt.xticks(fontsize=30);
- plt.yticks(fontsize=30);
- plt.savefig(fname="./test_pic.jpg",bbox_inches="tight");
- plt.close(fig1);
- Traceback (most recent call last):
- File "test.py", line 13, in <module>
- plt.savefig(fname="./test_pic.jpg",bbox_inches="tight");
- File "/<my_home>/.local/lib/python2.7/site-packages/matplotlib/pyplot.py", line 697, in savefig
- res = fig.savefig(*args, **kwargs)
- File "/<my_home>/.local/lib/python2.7/site-packages/matplotlib/figure.py", line 1814, in savefig
- self.canvas.print_figure(fname, **kwargs)
- File "/<my_home>/.local/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 2259, in print_figure
- **kwargs)
- File "/<my_home>/.local/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 584, in print_jpg
- return background.save(filename_or_obj, format='jpeg', **options)
- File "/usr/lib64/python2.7/site-packages/PIL/Image.py", line 1477, in save
- save_handler(self, fp, filename)
- File "/usr/lib64/python2.7/site-packages/PIL/JpegImagePlugin.py", line 565, in _save
- ImageFile._save(im, fp, [("jpeg", (0,0)+im.size, 0, rawmode)], bufsize)
- File "/usr/lib64/python2.7/site-packages/PIL/ImageFile.py", line 470, in _save
- e = Image._getencoder(im.mode, e, a, im.encoderconfig)
- File "/usr/lib64/python2.7/site-packages/PIL/Image.py", line 395, in _getencoder
- return encoder(mode, *args + extra)
- TypeError: integer argument expected, got float
Add Comment
Please, Sign In to add comment