Python Forum

Full Version: Matplotlib Colorbar Ticks (Increase number)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi together!:)
I've got a problem concerning the ticks on a colorbar for a contourf plot.
Let's say I've got 20 Levels in the contourf plot. (plt.contourf(x,y,z, levels) )
Somehow, I do only get 17 "segments" in the corresponding colorbar.

But this is not the main problem.
At the current state, only every second "segment" is labelled with a tick. Is there a possibility to set the option to label(with tick) every segment?
I already found the solution to define the ticks manually by np.linspace and set_ticks etc., but this solution also places the ticks somewhere and not exactly on the segment boundary.
I also found some posts stating the "MaxNLocator(nbins=5)", but this does not work in my case somehow.

[Image: colorbar.jpg]

[Image: colorbar.png.html]
Thank you!:)
I found a solution to my problem, if someone is interested:
As it always is, the solution appears directly after asking for help.

https://stackoverflow.com/questions/3504...-matplotli

Thanks :)