Please enable JavaScript.
Coggle requires JavaScript to display documents.
Python - matplotlib (Figure creation (fig = plt.figure(figsize=(x, y),…
Python - matplotlib
Figure creation
fig = plt.figure(figsize=(x, y), dpi)
axes = fig.add_axes([left, bottom, width, height])
axes.plot(x, y)
axes.set_xlabel('name')
axes.set_ylabel('name')
axes.set_title('plot_title')
fig, axes = plt.subplots(nrows, ncols)*
fig.savefig('filename.png')
Basics
plt.plot(x, y, color)
plt.xlabel('name')
plt.ylabel('name')
plt.title('plot_title')
plt.show()
Subplots
plt.subplot(nrows,, ncols, plot_number)
Special plot types
plt.scatter()
plt.hist()
plt.boxplot()
Legends
ax.plot(x, y, label='text_legend1')
ax.legend(loc)
loc=1 - upperright
loc=2 - upperleft
loc=3 - lowerleft
loc=4 - lowerright
Visual aspects
color
plt.plot(x, y, color='blue'/'red'/hexcode)
line
linewidth (lw)
plt.plot(x,y,lw=float)
linestyle (ls)
'-'
'-.'
':'
marker
marker symbols
+, 0, *, s, , , ., 1, 2, 3, 4
markersize
import matplotlib.pyplot as plt