[yt-dev] Callbacks for the Plot Window

Nathan Goldbaum goldbaum at ucolick.org
Sun Jul 8 20:10:09 PDT 2012


Hi all,

Matt and I have been thinking about how to port the already existing callbacks to the new Plot Window plotting interface.  We've come down to two choices that we'd like to the put to the list to vote on.

The first choice is to leave the interface exactly the same and use dict-like access through a .modify member that hangs off the PlotWindow object.  So, for example, if you wanted to add grids to a plot, it would look something like this:

>> slc = SlicePlot(pf, 0, 'Density')
>> slc.modify['grids']()

Alternatively, the callbacks could hang off of the plot window object as attributes:

>> slc = SlicePlot(pf, 0, 'Density')
>> slc.annotate_grids()

Personally, I prefer the second choice since it leaves the list of annotations available at runtime.  In ipython, for example, I could say slc.annotate<tab> and then get a list of all of the available plot modifications for this object.  

Both choices are about equally complicated syntactically since the attributes can be dynamically generated based on a list of available callbacks in plot_modifications.py.

If you have an opinion, please reply with a vote for your preferred option.

Cheers,

Nathan Goldbaum


More information about the yt-dev mailing list