[yt-dev] Profile Plotting

Matthew Turk matthewturk at gmail.com
Mon Dec 3 11:02:21 PST 2012


Hi all,

As I noted in my other email, there was one major feature we'd talked
about for yt 2.5 that we never even really worked on.  Nathan and
others pushed really hard on rethinking and redesigning the way image
plots were made and handled back in the 2.4 series, which eliminated
the main use case for the PlotCollection.  However, the remaining
firewalls on PlotCollection are the 1-D and 2-D phase plots.

There's been broad consensus that we need a new method for doing this,
analogous to how PlotWindow serves to replace "add_slice" and
"add_projection" from the PlotCollection.  Something that gets out of
the way and lets people modify their plots as they see fit.

A while back I implemented a first pass at this, which you can see in
yt/visualization/profile_plotter.py:

https://bitbucket.org/yt_analysis/yt/src/711e95aff04b54e6ccda7dfefb0b0ae17c3830a7/yt/visualization/profile_plotter.py?at=yt

The idea here is that you create an instance of ProfilePlotter or
PhasePlotter, which then "Does the right thing" and creates the
necessary data objects and the like.  This object can then either
create its own axes+figure in matplotlib, or it can deposit itself
into an existing axes object.  It includes axis objects and plot
containers that know how to plot themselves.

I don't know that I necessarily like how this is done.  It's very
declarative, and step by step, but I think it could be easier.  Here's
an example:

https://hub.yt-project.org/go/vlilvw

One thing I think *is* quite nice is that the *plot* object is
independent of the profile itself.  This makes it easier to pickle and
unpickle things, and is the reason for the existence of the various
sub-objects off of ProfilePlotter.  This is useful for the use case of
making very large datasets into profiles, pickling the resulting
plots, and modifying them later.

So here are my specific questions:

 * Does this rough outline of how the object works seem good?  As in,
making a plotter object, making it have a sub .plot object, and then
dispatching that plot object to various backends?  (Probably nearly
always matplotlib.)
 * Should we add on additional convenience operations?
 * How should it interface with existing profiles?
 * Should implementing this and finalizing the design be a blocker for 2.5?

I will create and update a YTEP with the resulting discussion from
this.  Nathan, Jeff and Britton -- I would very much appreciate your
feedback, as I know you have experience with (respectively) plot
windows, matplotlib, and large datasets being profiled.

-Matt



More information about the yt-dev mailing list