color bar label in multiple panel projection plot
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
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
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@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
Yep that worked - thanks Cameron!
On Fri, Aug 15, 2014 at 10:24 AM, Cameron Hummels
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
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@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@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
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
Yep that worked - thanks Cameron!
On Fri, Aug 15, 2014 at 10:24 AM, Cameron Hummels
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
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@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@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (3)
-
Cameron Hummels
-
Desika Narayanan
-
Nathan Goldbaum