Difference between revisions of "Matplotlib"

From wiki
Jump to navigation Jump to search
m
Line 3: Line 3:
 
;import matplotlib.pyplot as plt
 
;import matplotlib.pyplot as plt
 
:Get the pyplot library. We assume this is done in all examples on this page.
 
:Get the pyplot library. We assume this is done in all examples on this page.
;plt.plot(results)
+
;plt.plot(array)
:Show the graph if your environment (e.g. [https://jupyter.org/ jupyter]) supports it.
+
:Create the graphical object from the values in the array. Show the graph if your environment (e.g. [https://jupyter.org/ jupyter]) supports it.
  
 
Selfexplaning example code:
 
Selfexplaning example code:
 
<syntaxhighlight lang=python>
 
<syntaxhighlight lang=python>
 +
plt.plot(array)
 
plt.suptitle('Set the graph tilte')
 
plt.suptitle('Set the graph tilte')
 
plt.xlabel('Set the x label')
 
plt.xlabel('Set the x label')

Revision as of 23:16, 15 December 2018

link titleUsing the pyplot functions only until now.

import matplotlib.pyplot as plt
Get the pyplot library. We assume this is done in all examples on this page.
plt.plot(array)
Create the graphical object from the values in the array. Show the graph if your environment (e.g. jupyter) supports it.

Selfexplaning example code:

plt.plot(array)
plt.suptitle('Set the graph tilte')
plt.xlabel('Set the x label')
plt.ylabel('Set the y label')
plt.savefig('plot.png')

Show the image:

firefox plot.png
eog plot.png
shotwell plot.png