简体   繁体   English

Meshgrid等高线图的不一致数据集

[英]Meshgrid an inconsistent dataset for a contour plot

I change my inconsistent dataset to a consistent dataset. 我将不一致的数据集更改为一致的数据集。 Now i have this problem: I dont understand how to create a contour out of three 1D Dataframe columns. 现在我有这个问题:我不明白如何从三个1D Dataframe列中创建轮廓。

How i can meshgrid them for the contour plot? 我如何为等高线图网格化它们? The three columns are: 这三列是:

data_month['Timestamp'], data_month['Altitude_[m]'], data_month['Horizontal_Wind_Speed_[m/s]']

The dimensions are: 尺寸为:

Name:  Timestamp, Length: 10692, dtype: datetime64[ns]
--------
Name: Altitude_[m], Length: 10692, dtype: int64
---------
Name: Horizontal_Wind_Speed_[m/s], Length: 10692, dtype: float64

So how I could meshgrid, reshape them? 那么我如何才能网格化,重塑它们呢? The data_month['Altitude_[m]'] repeats every 33 steps. data_month['Altitude_[m]']每33个步骤重复一次。

Thanks a lot. 非常感谢。

So I found a solution. 所以我找到了解决方案。 For me this works. 对我来说,这有效。

yi = np.linspace(minimum_range_m, maximum_range_m, number_of_gates)
xi = list(set(pd.to_datetime(data_month['Timestamp'].values.tolist())))
xi.sort()

zi = data_month['Horizontal_Wind_Speed_[m/s]'].values.tolist()
Zi = np.reshape(zi, (len(xi),len(yi))).T

fig, ax = plt.subplots()
cp = plt.contourf(xi, yi, Zi)
fig.colorbar(cp)
plt.show()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM