How can I extract the currently displayed ticks of a matplotlib
colorbar as a list? With this example I should get the the list with floats[-0.6, -0.4, -0.2, 0, 0.2, 0.4, 0.6]
import matplotlib.pyplot as plt
import numpy as np
img = np.random.normal(0, 0.2, size=(100,100))
plt.imshow(img)
plt.colorbar()
plt.show()
In version 2.1 of matplotlib colorbar.get_ticks()
method was introduced.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With