import matplotlib.pyplot
import numpy
import pandas
if __name__ == '__main__':
dataframe = pandas.DataFrame(numpy.array([[1, 0.2, 10, 4], [2, 0.25, 8, 2], [3, 0.24, 8, 3], [4, 0.3, 6, 1]]),
columns=["Day", "Price", "Count", "Like"])
axes = dataframe.plot(x="Day", sharex=False, subplots=[("Price",), ("Count", "Like")], layout=(1, 2))
axes[0, 0].set_ylabel("Price (unit: yuan)")
axes[0, 1].set_ylabel("Count (unit: number)")
matplotlib.pyplot.tight_layout()
matplotlib.pyplot.show()
结果图:
1 条评论
网站设计太糟糕了,正文页面太窄,显示不全,对safari很不友好