简单到:import pandas
import matplotlib.pyplot as plt
import random
# Generate some random data
df = pandas.DataFrame({'a': [random.uniform(0,0.05) for i in range(15)],
'b': [random.uniform(0,0.05) for i in range(15)],
'c': [random.uniform(0.8,1) for i in range(15)],
'd': [random.uniform(0.8, 1) for i in range(15)],
'e': [random.uniform(0.8, 1) for i in range(15)]})
plt.plot(df)
退货:
但我建议将它们分开绘制:
^{pr2}$
尖叫着:
添加:
可以为绘图的每一侧设置不同的比例:fig, ax = plt.subplots()
plt.plot(df['a'], ' r', label='Line a')
plt.plot(df['b'], ' k', label='Line b')
plt.legend()
ax.tick_params('vals', colors='r')
# Get second axis
ax2 = ax.twinx()
plt.plot(df['c'], ' b', label='Line c')
plt.plot(df['d'], ' g', label='Line d')
plt.plot(df['e'], ' c', label='Line e')
plt.legend()
ax.tick_params('vals', colors='b')
不是最漂亮的,但你明白了。在