[yt-users] Plot titles
David Collins
dcollins at physics.ucsd.edu
Tue Jun 16 11:44:46 PDT 2009
> I believe that you should be okay directly modifying the _axes object
> of the plot, if you are modifying profile plots. This is probably not
> plot = pc.add_phase_sphere(...)
> plot._axes.title("My Title")
This was the first thing that I tried, but it looks like the title
field gets wiped during the save. I did
>>> pf = MyOutputs.FileStaticOutput(file)
>>> pc = raven.PlotCollection(pf)
>>> region = pf.h.region([0.5]*3,[0.0]*3,[1.0]*3)
>>> profile = pc.add_profile_object(region,['Density','VolumeFraction'])
>>> profile._axes.set_title('Bacon Hat Density')
>>> print profile._axes.title
Text(1,1,'Bacon Hat Density')
>>> pc.save('stuff.png')
>>> print profile._axes.title
Text(1,1,'')
and there's no title on the resulting plot. Is there something
obviously dumb with the above, aside from the plot title?
I can make a callback that does it, and it works fine, though-- for
those of you following along, I did
class title(raven.PlotCallback):
def __init__(self, title="Plot"):
self.title = title
def __call__(self,plot):
plot._axes.set_title(self.title)
profile.add_callback(dave_callback.title(title))
d.
>
> You could accomplish this by something like:
>
> plot = pc.add_phase_sphere(...)
> plot._axes.title("My Title")
>
> You can also access the figure with _figure.
>
> The callback interface is something of a pragmatic approach to the
> system of plotting used for variable mesh plots -- slices,
> projections, etc. The idea was that one should be able to overlay a
> set of data-oriented modifications to the plot, because for a given
> plot, multiple images might get saved, for instance at different
> widths. So I set up a system of "callbacks" designed such that every
> time the plot was erased and recreated, it would have (laid on top)
> the same contours, or velocity, but changed the same way the image had
> been changed. So for a "Density" zoomin, you'd only have to add the
> "Temperature" contours once, and every time you changed the width they
> would be updated.
>
> Because the variable mesh plots have their axes wiped between updates
> of the image data, all the other data plotted on those axes are wiped
> as well. That's why the callbacks are necessary for things like
> simple annotations. The long term strategy for the callbacks is to
> provide a much simpler interface for very simple things. I hope to
> implement this very soon.
>
> -Matt
>
> On Mon, Jun 15, 2009 at 4:41 PM, david collins<antpuncher at gmail.com> wrote:
>> Hi--
>>
>> Is there a non-callback way to add plot titles to things like profiles?
>>
>> d.
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.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
>
>
More information about the yt-users
mailing list