绘图:逆色标刻度值 [英] Plotly map: inverse colorscale tick values

查看:86
本文介绍了绘图:逆色标刻度值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Plotly贴图(Python)中,如何反转色标上的刻度标签,以使最小值位于顶部,而最大值位于底部?例如,顶部的-100和底部的100?

In Plotly maps (Python), how can I inverse the tick labels on the colorscale so that the smallest value is at the top and the largest at the bottom? For example, -100 at the top and 100 at the bottom?

注意:我不想更改颜色,而只想更改相关的刻度值.

Note: I do not want to change the colors, just the associated tick values.

推荐答案

您可以使用 ticktext 输入

在颜色条定义中,包括tickmode="array"以及ticktext=tickvals= 像这样:

In your colorbar definition, include tickmode="array" along with ticktext= and tickvals= Something like this:

colorbar=dict(tickmode="array",ticktext=[100,-100],tickvals=[-100,100])

这篇关于绘图:逆色标刻度值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆