[英]How to create a custom colormap with black under a specific threshold with Seaborn
我的速度值范围从 0 到 4000(米/年),我想要一个像照片示例中那样的颜色图,但 1000 以下的所有内容都是黑色的。 关于如何做到这一点的任何想法? 我一直在尝试使用center
,但没有成功。 我使用的代码是:
# Plot Hovmoller diagram
# turn the axis label
df_velocity = df_velocity.sort_index()
df_velocity2 = df_velocity.fillna(0) # I replace all my nans by zeros otherwise there are too many holes in my plot
plt.figure(figsize=(15,15))
ax = sns.heatmap(df_velocity2,vmin=0, vmax=4000)#,center=1000)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.