Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

How to print specific figure in python

# load matplotlib modules
import matplotlib
import matplotlib.pyplot as plt
import numpy as np

# data to plot
y = [2,4,6,8,10,12,14,16,18,20]
x = np.arange(10)

# create plot
fig = plt.figure()
ax = plt.subplot(111)
ax.plot(x, y, label='$y = numbers')
plt.title('Legend inside')
ax.legend()

# save plot to file
fig.savefig('plot.png')
Source by pythonspot.com #
 
PREVIOUS NEXT
Tagged: #How #print #specific #figure #python
ADD COMMENT
Topic
Name
3+3 =