[yt-users] color bar label in multiple panel projection plot

Nathan Goldbaum nathan12343 at gmail.com
Fri Aug 15 10:04:30 PDT 2014


For posterity, you can also do this:

import yt
ds = yt.load(filename)
prj = yt.ProjectionPlot(ds, 0, 'density')
prj.set_colorbar_label('density', 'arbitrary label')

Best,

Nathan


On Fri, Aug 15, 2014 at 7:28 AM, Desika Narayanan <dnarayan at haverford.edu>
wrote:

> Yep that worked - thanks Cameron!
>
>
> On Fri, Aug 15, 2014 at 10:24 AM, Cameron Hummels <chummels at gmail.com>
> wrote:
>
>> Hi Desika,
>>
>> Try this instead:
>>
>> >    px = ProjectionPlot(ds1,'x',("deposit","PartType0_smoothed_density"))
>> >    plot = px.plots[('deposit','PartType0_smoothed_density')]
>> >    plot.cax.yaxis.set_label_text("N$_H$ g cm$^{-2}$")
>>
>> Cameron
>>
>>
>> On Fri, Aug 15, 2014 at 6:21 AM, Desika Narayanan <dnarayan at haverford.edu
>> > wrote:
>>
>>> Hi All,
>>>
>>> I'm trying to make a plot similar to the pre-fab projection time-series
>>> example described here:
>>>
>>>
>>> http://yt-project.org/doc/cookbook/complex_plots.html#time-series-multipanel
>>>
>>> I'd love it if the colorbar label didn't say
>>> "PartType0_smoothed_density" or whatever, but rather something physical.
>>>
>>> In the past, I've been able to (thanks to Nathan's advice) access the
>>> matplotlib primitives for a single projection plot via something like:
>>>
>>> >    px =
>>> ProjectionPlot(ds1,'x',("deposit","PartType0_smoothed_density"))
>>> >    plot = px.plots[('deposit','PartType0_smoothed_density')]
>>> >    colorbar_axes = plot.cax
>>> >    colorbar_axes.set_ylabel("N$_H$ g cm$^{-2}$")
>>>
>>>
>>> So, similarly, I thought I could try something like:
>>>
>>> >plot.cax.set_ylabel("N$_H$ g cm$^{-2}$")
>>>
>>> in the above time-series example, but it doesn't seem to adjust the
>>> colorbar label.  I'm sure I'm missing something obvious but can't seem to
>>> figure it out - any help would be greatly appreciated.
>>>
>>> thanks!
>>> desika
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> yt-users mailing list
>>> yt-users at lists.spacepope.org
>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>
>>>
>>
>>
>> --
>> Cameron Hummels
>> Postdoctoral Researcher
>> Steward Observatory
>> University of Arizona
>> http://chummels.org
>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20140815/76f8ba5e/attachment.htm>


More information about the yt-users mailing list