accessing colorbar directly

Dear all,
I am in the process of moving most of my visualisation scripts from PlotCollection to the PlotWindow interface. One feature that now I am not able to find is the capability of customising the tick values in the colorbar of a plot. Inspired by the example script found in
http://yt-project.org/docs/2.5/cookbook/simple_plots.html#accessing-and-modi... ,
I was thinking about interacting with a matplotlib object directly, but I am not able to find a suitable one. Could you please suggest me a workaround for this issue? Thanks in advance,
Luigi

Hi Luigi,
You can access the colobar and colorbar axes like so:
slc = SlicePlot(pf, 'x', 'Density') plot = slc.plots['Density'] colorbar = plot.cb colorbar_axes = plot.cax
Take a look at this notebook for an example: http://nbviewer.ipython.org/url/hub.yt-project.org/notebooks/8bc973e0da2d469...
Let us know if you have any trouble getting this working for your use case.
-Nathan
On Wed, Sep 25, 2013 at 8:22 AM, Luigi Iapichino luigi@uni-heidelberg.dewrote:
Dear all,
I am in the process of moving most of my visualisation scripts from PlotCollection to the PlotWindow interface. One feature that now I am not able to find is the capability of customising the tick values in the colorbar of a plot. Inspired by the example script found in
http://yt-project.org/docs/2.5/cookbook/simple_plots.html#accessing-and-modi...,
I was thinking about interacting with a matplotlib object directly, but I am not able to find a suitable one. Could you please suggest me a workaround for this issue? Thanks in advance,
Luigi
--
Luigi Iapichino Universität Heidelberg, Zentrum für Astronomie Institut für Theoretische Astrophysik Philosophenweg 12, D-69120 Heidelberg, Germany Tel: +49 6221 548983, Fax: +49 6221 544221 e-mail: luigi@uni-heidelberg.de URL: http://www.ita.uni-heidelberg.de/~luigi/ _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org

Hi Nathan,
thanks, it worked exactly in the way I meant! Just for your information: my problem was to customize a slice of GridLevel, in such a way to have the word "AMR level" on the colorbar, and to have integer values for the ticks. Using your suggestion, I did that in the following way (pf and c given elsewhere in my script):
sll = SlicePlot(pf, 'x', "GridLevel", c, width = (8.0, 'mpccm')) sll.set_log("GridLevel", False) sll.set_zlim("GridLevel", 0.0,8.0) colorbar = sll.plots['GridLevel'].cb colorbar.set_label("AMR level") colorbar.set_ticks([1.0,3.0,5.0,7.0]) colorbar.set_ticklabels([1,3,5,7]) sll.save()
Cheers,
Luigi
On Wednesday 25 September 2013, Nathan Goldbaum wrote:
Hi Luigi,
You can access the colobar and colorbar axes like so:
slc = SlicePlot(pf, 'x', 'Density') plot = slc.plots['Density'] colorbar = plot.cb colorbar_axes = plot.cax
Take a look at this notebook for an example: http://nbviewer.ipython.org/url/hub.yt-project.org/notebooks/8bc973e0da2d46 97a8e1d5a7a203d19d.ipynb
Let us know if you have any trouble getting this working for your use case.
-Nathan
On Wed, Sep 25, 2013 at 8:22 AM, Luigi Iapichino
luigi@uni-heidelberg.dewrote:
Dear all,
I am in the process of moving most of my visualisation scripts from PlotCollection to the PlotWindow interface. One feature that now I am not able to find is the capability of customising the tick values in the colorbar of a plot. Inspired by the example script found in
http://yt-project.org/docs/2.5/cookbook/simple_plots.html#accessing-and-m odifying-plots-directly,
I was thinking about interacting with a matplotlib object directly, but I am not able to find a suitable one. Could you please suggest me a workaround for this issue? Thanks in advance,
Luigi
--
Luigi Iapichino Universität Heidelberg, Zentrum für Astronomie Institut für Theoretische Astrophysik Philosophenweg 12, D-69120 Heidelberg, Germany Tel: +49 6221 548983, Fax: +49 6221 544221 e-mail: luigi@uni-heidelberg.de URL: http://www.ita.uni-heidelberg.de/~luigi/ _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (2)
-
Luigi Iapichino
-
Nathan Goldbaum