【发布时间】:2019-07-18 16:49:39
【问题描述】:
我试图将 pandas 列中的数据可视化为 3D 散点图。我正面临将颜色条匹配调整为我的 z 轴的确切大小的问题。
我的代码:
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
s = pd.read_csv('FahrerVP8.out_1.csv', index_col=0)
ax = plt.figure()
three_d = ax.gca(projection='3d')
three_d1 = three_d.scatter(s['Latitude'], s['Longitude'],s['Mean_ VehicleSpeed'], c =s['Mean_ VehicleSpeed'] )
three_d.set_xlabel('Latitude')
three_d.set_ylabel('Longitude')
three_d.set_zlabel('Mean Vehicle Speed')
plt.colorbar(three_d1)
plt.show()
我的结果
我想用 z 轴高度调整我的颜色条高度。
【问题讨论】:
-
我不确定你想要什么。你想改变颜色吗? “用轴调整颜色图”是什么意思?
-
1.我希望彩条高度与 z 轴高度相同。@AdamBellaïche
-
也许你会在这里找到答案:stackoverflow.com/questions/18195758/…
标签: python python-3.x pandas matplotlib scatter-plot