2024-09-24 22:19:20 发布
网友
所以,我有一个站点列表(字符串),如下所示:
station_list=[station1, station2, station3, ..., station63]
我有一个列表,上面有每个站点的测量值,但是它们的测量值不一样。所以,我有这样的东西:
Measurement_列表有63个“子列表”,每个站点有一个子列表。在
最后,我想创建一个图表,其中x轴上的站点和y轴上的度量值,以便比较所有站点的度量值。在
谢谢你的帮助。(为我糟糕的英语感到抱歉;)
我建议如下this example ...
以下是一个改编的结果:
import numpy as np import matplotlib.pyplot as plt station_list=['station1', 'station2', 'station3', 'station63'] measure_list=[ [200.0, 200.0, 200.0, 200.0, 200.0, 300.0], [400.0, 400.0, 300.0, 300.0, 300.0, 300.0, 300.0, 300.0, 300.0], [300.0, 400.0, 400.0, 400.0, 400.0], [1000.0, 1000.0, 1000.0, 1000.0, 1000.0], ] x = range(len(station_list)) assert len(station_list) == len(measure_list) == len(x) for i, label in enumerate(station_list): y_list = measure_list[i] x_list = (x[i],) * len(y_list) plt.plot(x_list, y_list, 'o') # You can specify a rotation for the tick labels in degrees or with keywords. plt.xticks(x, station_list, rotation='vertical') # Pad margins so that markers don't get clipped by the axes # plt.margins(0.2) plt.xlim(np.min(x) - 0.5, np.max(x) + 0.5) # Tweak spacing to prevent clipping of tick-labels plt.subplots_adjust(bottom=0.15) plt.show()
它给出了:
我建议如下this example ...
以下是一个改编的结果:
它给出了:
相关问题 更多 >
编程相关推荐