Difference between revisions of "Statistical Algorithms Importer: Python Project FAQ"
From Gcube Wiki
(→Matplotlib) |
(→Matplotlib) |
||
Line 10: | Line 10: | ||
<source lang='python'> | <source lang='python'> | ||
− | + | # | |
+ | # author Giancarlo Panichi | ||
+ | # | ||
+ | # Write file image.png | ||
+ | # | ||
import matplotlib as mpl | import matplotlib as mpl | ||
mpl.use('Agg') | mpl.use('Agg') |
Revision as of 17:40, 20 December 2017
Contents |
F.A.Q. of Statistical Algorithms Importer (SAI), here are common mistakes we have found in Python Project.
Matplotlib
Matplotlib require the $DISPLAY environment variable which means a running X server. DataMiner service do not allow a running X server session. So your code must be modified:
# # author Giancarlo Panichi # # Write file image.png # import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt import numpy as np .... plt.imshow(image) plt.savefig('image.png')