Sorry for taking so long to respond to this, I'm catching up on e-mail.
I think you almost had the right approach, but got caught up in the
matplotlib internal API not doing something sensible. Rather than touching
the colorbar axes, you should instead go through the colorbar object itself:
cb = p.plots[string].cb
cb.set_ticks([0, 0.1, 0.8])
There's an example that does this in the yt docs:
On Thu, Jul 16, 2015 at 2:10 PM, Gabriel Goodwin <ggoodwin52(a)gmail.com>
Does anyone know how to specify the tickmark locations on the colorbar
axis? I am able to do this on the plot axes without issue, but have not
been able to successfully do the same with the colorbar.
Attached is a pic of one of my plots using default colorbar axis ticks. I
have tried to use the following code (and many variants of it I have found
in the python/matplotlib documentation) to specify the location of the
tickmarks, but they don't place the ticks accurately. My data is
temperature plotted over the range of 300K to 5500K and I want to have
tickmarks at 300K, 800K, 3500K, and 4500K. Also attached is pic of my plot
showing an attempted custom colorbar axis.
I'm not sure if it makes a difference, but I made the colormap in
colorbar_axes = p.plots[string].cax
colorbar_axes.yaxis.set_ticks([0, 0.1, 0.8])
Thanks for the help!
yt-users mailing list