[英]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.