Python Forum
Matplotlib Colorbar Ticks (Increase number)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Matplotlib Colorbar Ticks (Increase number)
#1
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!:)
Reply
#2
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 :)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Cannot remove one of the x-ticks from a 2x1 subplot. generalzu10 1 245 Mar-20-2024, 04:24 AM
Last Post: generalzu10
  How to set a sequence of midi note on and note off values in ticks tomharvey 2 2,147 Mar-25-2022, 02:33 AM
Last Post: tomharvey
  Increase the speed of a python loop over a pandas dataframe mcva 0 1,314 Jan-21-2022, 06:24 PM
Last Post: mcva
  [Solved] Matplotlib - Tricontour: how to set colorbar range ju21878436312 1 6,589 Dec-13-2021, 07:44 PM
Last Post: ju21878436312
  How to increase the size of a png picture for the heatmap of the correlation? lulu43366 9 3,502 Oct-06-2021, 04:15 PM
Last Post: deanhystad
  Using SoX in Python to Increase mp3 Bitrate DRT 1 1,749 Jul-10-2021, 08:41 PM
Last Post: DRT
  Missing ticks on X axis drunkenneo 0 1,727 May-29-2021, 04:16 PM
Last Post: drunkenneo
  Matplotlib: How do I convert Dates from Excel to use in Matplotlib JaneTan 1 3,221 Mar-11-2021, 10:52 AM
Last Post: buran
  Clicker count increase by 1 each time blakefindlay 1 5,650 Feb-03-2021, 03:50 PM
Last Post: deanhystad
  increase and decrease a slice value? KEYS 2 2,090 Nov-10-2020, 11:35 PM
Last Post: KEYS

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020