Difference between revisions of "Statistical Algorithms Importer: Python Project FAQ"

From Gcube Wiki
Jump to: navigation, search
(Created page with "{| align="right" ||__TOC__ |} F.A.Q. of Statistical Algorithms Importer (SAI), here are common mistakes we have found in Python Project. == Matplotlib == Matplotlib require...")
 
(Matplotlib)
Line 9: Line 9:
 
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:
 
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:
  
 +
<source lang='python'>
  
 
import matplotlib as mpl
 
import matplotlib as mpl
Line 18: Line 19:
  
  
plt.imshow(im)
+
plt.imshow(image)
plt.savefig('im.png')
+
plt.savefig('image.png')
 
+
</source>
  
 
[[Category:Statistical Algorithms Importer]]
 
[[Category:Statistical Algorithms Importer]]

Revision as of 18:39, 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:

import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
 
....
 
 
plt.imshow(image)
plt.savefig('image.png')