[yt-users] More PhasePlots questions

Nathan Goldbaum nathan12343 at gmail.com
Thu Jan 30 11:43:32 PST 2014


Hi Stephanie,

Sorry to hear you're having trouble,

On Thu, Jan 30, 2014 at 8:58 AM, Stephanie Tonnesen <stonnes at gmail.com> wrote:
> Hi everyone!
>
> I have a few more PhasePlots questions.
> 1)  I would like to force my axes to be a particular range.  I am looking at
> several times in my simulation, and the length of the stripped tail
> increases, so different PhasePlots end up with different height above the
> disk x-axis ranges, which makes comparison more annoying.
>

Unfortunately right now it's not possible to specify the x and y range
from the ProfilePlot constructor without passing in a custom profile
object.  This is something that (I think) would be relatively
straightforward to add, just no one has gotten around to it.  If you'd
be interested in trying, most of the logic is in
$YT_HG/yt/visualization/profile_plotter.py and
$YT_HG/yt/data_objects/profiles.py.

Right now, the way to get custom a PhasePlot it to pass it a custom
Profile3D instance.

What's happening under the hood is that PhasePlot uses the
create_profile function to create a Profile2D instance.  Profile2D is
what's doing the hard work of creating the histogram that PhasePlot
displays using matploltib. Right now create_profile doesn't accept x
and y extrema either (another thing that wouldn't be hard to add, I
think...), so you'll need to go a little bit lower level and create a
Profile2D instance directly.

Here's an example that creates a PhasePlot using a custom profile:

https://hub.yt-project.org/nb/nph2ua

> 2)  I would like for the last tick label to be blank--to not print out on
> the figure (in the attachment, I would like for '100' to not be there).
>

You can customize the tick marks by accessing the matplotlib axes
object.  See this notebook for an example:

http://nbviewer.ipython.org/url/hub.yt-project.org/notebooks/30321a3619b04c358198a7967d314523.ipynb

> 3)  On a slightly different note, I want the bin size to be bigger.  The
> PhasePlots look very streaky, see attached.
>

Using a custom profile with a bigger bin size than the one yt chooses
by default should help.  You can also choose the number of bins along
the x and y direction using the x_bins and y_bins keyword arguments
for the PhasePlot constructor.

Hope that helps,

Nathan


> I will paste my current set of commands for making my PhasePlot.  Thanks for
> any help!
>
> Stephanie
>
>
> plot =
> PhasePlot(tracerp25,"zkpc","zvelocity8",["CellMassMsun"],weight_field=None,fontsize=19)#,x_bounds=[3e-28,5e-23],y_bounds=[-0.7,1.2])
> plot.set_log("zkpc",False)
> plot.set_log("zvelocity8",False)
> plot.set_zlim("CellMassMsun",1e4,1e9)
> plot.set_figure_size(3)
>
> ax = plot.plots['CellMassMsun'].axes
> ax.set_ylabel(r'z-velocity (10$^8$ cm/s)',fontsize=10)
> ax.set_xlabel(r'Height above disk (kpc)',fontsize=10)
> print r'z-velocity (10$^8$ cm/s)'
> for label in ax.xaxis.get_ticklabels():
>     #label.set_color('red')
>     label.set_rotation(35)
>     label.set_fontsize(11)
> for label in ax.yaxis.get_ticklabels():
>     label.set_fontsize(10)
>
> plot.save()
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>



More information about the yt-users mailing list