简体   繁体   English

获得Colorbar Ticks

[英]Get Colorbar Ticks

I am using a colorbar in matplotlib and because I want my graph to be more sensitive I take the square root of each value. 我在matplotlib中使用了一个颜色条,因为我希望我的图形更敏感,所以我取每个值的平方根。 This gives me square rooted values on my colorbar, but now I want to scale the ticks labels back to the real values. 这给了我在我的颜色条上的平方根值,但现在我想将刻度标签缩放回实际值。 I am thusly having a hard time doing. 因此,我很难做。 I see that colorbar has a set_ticks function but I need to be able to get my ticks in the first place to do this generally. 我看到colorbar有一个set_ticks函数,但我需要能够首先得到我的滴答声来做这个。 Is there an easy way to do this that I am not seeing, or some other way around this? 有没有一种简单的方法可以做到这一点,我没有看到,或者其他方式?

Calling the locator for the colorbar instance should return the tick locations. 调用colorbar实例的定位器应该返回刻度位置。 colorbar.locator() . colorbar.locator()

在matplotlib 2.1中,您可以使用colorbar.get_ticks()方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM