I check it every time.
If you pass an ax array when subplots = True
, it will subplot nicely, and if you specify cmap
to change the color for each line, there is not much information, so it may be useful for someone.
import matplotlib.pyplot as plt
from matplotlib import cm
_, ax = plt.subplots(2,1, figsize=(16, 8))
df.plot(
grid=True, #Attach the grid
style='-', #Specifying the line style
cmap=cm.tab20, #Change line colormap
subplots=True, #Separate subplot for each line
ax=axes, #Number of columns and len(axes)If there is, it will subplot nicely
)
plt.show()
--You can use cm.get_cmap ("tab20 ")
instead of cm.tab20
.
--You can use cm.tab20.colors [n]
for colors such as plt.plot
.
Recommended Posts