While I haven’t tried this, so there might be a few extra things to do to make this work… You could first call
ticks = cbar.ax.get_yticks()
tickStrs = [label.get_text() for label in cbar.ax.get_yticklabels()]
to get the list of tick locations and the strings.
Then, insert any additional ticks at whatever locations you want in ‘ticks’.
Next, insert the desired strings at the same locations in ‘tickStrs’.
Then, update the tick locations and strings in cbar:
The use of update_ticks=False is to defer the actual processing of the tick data until later. This is to avoid conflicts with the differing lengths of tick locations and tick labels. The update would then occur at the end of set_ticklabels().
Note, I have not tested this, so there is no guarantee that this would work. Good luck!
On Fri, Sep 17, 2010 at 11:33 PM, Jeremy Conlin <jlconlin@…1972…> wrote:
On Fri, Sep 17, 2010 at 12:44 AM, Scott Sinclair > > <firstname.lastname@example.org> wrote:
On 16 September 2010 22:52, Jeremy Conlin <jlconlin@…287…> wrote:
I have a colorbar which has some ticks, but I would like to add my own
ticks without replacing any of the existing ones. In addition, I
would like to give the ticks a different labels like “min” and “max”.
Can someone show how this might be done?
should give you some ideas to get started.
Thanks for pointing me to that demo, it’s a good one. However, I want
the ticks that are generated automatically, in addition to the extra
ones I add. The demo seems to show how I can define my own only.