在3D散点图中添加一个点数的配色栏
我试图在3D图中绘制某个区域的地震,以颜色显示事件的时间/日期。但是,数据点是准确的,但是,当我绘制颜色栏仅显示0.0至1.0时。如何获得颜色栏以将日期显示为标签?
我的日期
变量是“ yyyy-mm-dd”格式中的日期列表。
%matplotlib notebook
from mpl_toolkits.mplot3d import axes3d
fig = plt.figure(figsize=(8,8))
ax = fig.add_subplot(projection='3d')
ax.scatter(longitude, latitude, -depth, c=mdates.date2num(dates), cmap='magma')
fig.colorbar(mpl.cm.ScalarMappable(cmap='magma'))
plt.show()
I am attempting to plot earthquakes of a certain region in a 3D plot with the color as a way to show time/date of the event. The data points are accurately colored, however, when I plot the color bar it only displays 0.0 to 1.0. How do I get the color bar to show the dates as its label?
My dates
variable is a list of dates in "YYYY-MM-DD" format.
%matplotlib notebook
from mpl_toolkits.mplot3d import axes3d
fig = plt.figure(figsize=(8,8))
ax = fig.add_subplot(projection='3d')
ax.scatter(longitude, latitude, -depth, c=mdates.date2num(dates), cmap='magma')
fig.colorbar(mpl.cm.ScalarMappable(cmap='magma'))
plt.show()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于您没有提供数据,因此我必须随机生成它。
Since you didn't provide the data, I had to randomly generate it.