|
・In Japanese
■Figure function description
Draw multiple graphs.
■Concrete example
The following must be written in common for each specific example.
import matplotlib.pyplot as plt
import numpy as np # Defined to use the arange function
Example (1)
To display it in one window, use the following.
x=np.arange(10)
y1=x*2
y2=x*x
plt.figure()
plt.subplot(2,1,1) # Defined first in 2 rows and 1 column graph
plt.plot(x, y1)
plt.subplot(2,1,2) # Defined second in 2 rows and 1 column graph
plt.plot(x, y2)
plt.show()
Example (2)
To display in multiple windows, use the following.
x=np.arange(10)
y1=x*2
y2=x*x
plt.figure()
plt.plot(x, y1)
plt.figure()
plt.plot(x, y2)
plt.show()
|
|