[yt-users] Plot title for PhasePlot

Rick Sarmento rsarment at asu.edu
Tue Oct 28 19:27:44 PDT 2014


Aaron, thanks very much. 

Yea, using the axes “set_title” worked nicely. Thx for including the example! I’m new to python and matplotlib.

Cheers!

Rick Sarmento
SESE Astronomy/Astrophysics Grad Student
rsarment at asu.edu







> On Oct 28, 2014, at 4:53 PM, Aaron Smith <asmith at astro.as.utexas.edu> wrote:
> 
> Hi Rick,
> 
> This looks like a bug to me, but I'm not 100% sure as I've never really used set_title in the past. As a workaround you may want to either:
> (i) use annotate_text calls, or
> (ii) work with the pyplot API directly, e.g. ax = plot['cell_mass'].axes will return the axes object which you can manipulate with standard matplotlib functions. You can even build the axes objects before making the PhasePlot if you want complete control.
> 
> Both methods are demonstrated here: nbviewer.ipython.org/github/astrosmith/Notebooks/blob/master/set_title.ipynb
> 
> Cheers,
> Aaron
> 
> 
> On 10/28/14, 4:39 PM, Rick Sarmento wrote:
>> Hello all,
>> 
>> I’m trying to generate some plot titles on my phase diagrams (RAMSES data)… But neither of the approaches works:
>> 
>> # fractional=True keyword -- divide the profile data by the sum. 
>> ds = yt.load("/Users/earnric/RAMSES-Data/cooling/output_00012/info_00012.txt")
>> ad = ds.all_data()
>> plot = yt.PhasePlot(ad, "density", "temperature", "cell_mass", weight_field=None, fractional=True )
>> zStr = "Gas phase z = %.1f" % ds.current_redshift
>> plot.set_zlim('cell_mass', 1e-9, 1e-1)
>> plot.set_title("cell_mass", zStr)   ## Approach 1
>> plot.plot_title=zStr  ## Approach 2
>> plot.show()
>> 
>> I can’t figure out (from the documentation) which is supposed to work! Both are listed here:
>> 
>> http://yt-project.org/docs/3.0/reference/api/generated/yt.visualization.profile_plotter.PhasePlot.html?highlight=phaseplot <http://yt-project.org/docs/3.0/reference/api/generated/yt.visualization.profile_plotter.PhasePlot.html?highlight=phaseplot>
>> 
>> Thx for the help...
>> 
>> 
>> Cheers!
>> 
>> Rick Sarmento
>> SESE Astronomy/Astrophysics Grad Student
>> rsarment at asu.edu <mailto:rsarment at asu.edu>
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org <mailto:yt-users at lists.spacepope.org>
>> http://lists.spacepope.org/listinfo.cgi/yt-users-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/20141028/37ef37d3/attachment.htm>


More information about the yt-users mailing list