[yt-users] Does anybody have a sample script for plotting a time-series of images from frb's?

John Regan johnanthonyregan at gmail.com
Thu Jan 16 10:31:09 PST 2014


Hi Kathy,

Have you looked at using EPS writer? The eps_multiplot_yt function should
do what you want.
A example of the function call is shown below.

I guess for your case NCOLS would be 20 and NROWS 1.
projections is a list of the objects you are trying to plot (it was
projections in my case but it could be profiles, slices etc).
margins is the distance between images in cm so you can place the images as
close as you want to each other.
cb_flags is a list of bools. This will be of len 20 in each case and each
set to True if you a color bar in each case.
You can shrink the color bar if you like in x and y dir - again optional.
Finally you can scale the plot using figsize. The title box will write the
timeseries number for you if that is what you meant too.

mp = eps.multiplot_yt(NCOLS, NROWS, projections, bare_axes=True,
margins=(0.75,0.75),
                              cb_flags=cb_flags, shrink_cb = (0.85, 0.95),
figsize=(12,12))
CurrentTime = FinalTime - pf.current_time * pf['years']
mp.title_box("$\Delta$T = %d yrs" % (CurrentTime), loc=(0.55,0.93),
                     color=white, bgcolor=None,
text_opts=[pyx.text.size.large])
 mp.save_fig("Temperature_Density_%04d" % (result_id),
                    format="eps")

Can't guarantee this will work but it's pretty powerful. Have a look at
yt/visualisation/eps_writer.py for more details.

John




On Thu, Jan 16, 2014 at 6:25 PM, Michael Zingale <
michael.zingale at stonybrook.edu> wrote:

> you might also want to keep in mind the matplotlib tight_layout() command
> which really helps with the spacing, etc. when doing multiple plots.
>
> Mike
>
>
> On Thu, Jan 16, 2014 at 11:22 AM, Matthew Turk <matthewturk at gmail.com>wrote:
>
>> Hi Kathy,
>>
>> Thanks for writing!  Sorry to hear things aren't working.
>>
>> On Wed, Jan 15, 2014 at 5:45 PM, Kathy Eastwood <kathy.eastwood at nau.edu>
>> wrote:
>> > Hi, everybody
>> >
>> > I've been working off the example scripts on the yt website, and can't
>> quite
>> > seem to do what I want to do.  I want to plot something like 20
>> tall/skinny
>> > images in a horizontal row, and label the time steps below, and put the
>> > colorbar vertically.  I am constrained to using frb's because my images
>> are
>> > not square.  I have managed to make a plot with three such images,
>> although
>> > I haven't managed to put in the time step labels, and there is white
>> space
>> > between the images.  But it was very much brute force -- I had to
>> create a
>> > separate set of axes for each image.
>>
>> So, I think you might end up having to do it brute force.  Getting the
>> layout precisely correct may be tricky, and you'll probably want to
>> adjust it carefully to make it look exactly as you like.
>>
>> >
>> > All the example scripts that use frb's use the "get_multi_plot" inside
>> yt,
>> > whereas the only example of a time series in the image plots uses the
>> > AxesGrid from matplotlib. I have not managed to make the AxesGrid work
>> with
>> > an frb.  There is also a non-image-plotting example in the bootcamp of
>> using
>> > "TimeSeriesData" to go through a lot of files, which would be great,
>> but I
>> > have not been able to figure out how to translate that into what I need.
>>
>> get_multi_plot is not the best -- I think AxesGrid might be the best
>> bet, but I have not had too much experience.  In general, you may not
>> even need it, if you can construct your own axes by creating a Figure
>> in matplotlib of the right size, and then Axes objects within it.  But
>> I'm not sure I have a ready made solution that does 20 in a row.  I
>> know Jeff Oishi has done N in a row (where 5<N<20) but I don't know if
>> he's got the script handy.
>>
>> -Matt
>>
>> >
>> > If anybody has a sample script of something vaguely similar to this, I
>> would
>> > really appreciate it!
>> >
>> > thanks
>> > kathy
>> >
>> > --
>> > Kathy DeGioia Eastwood, Ph.D.
>> > Professor of Physics and Astronomy
>> > Northern Arizona University
>> > Flagstaff, AZ 86011-6010
>> > Ph: 928-523-7159   FX: 928-523-1371
>> > Kathy.Eastwood at nau.edu
>> > deliveries: 602 S. Humphreys St., Bldg 19 Rm 209
>> >
>> > _______________________________________________
>> > 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
>>
>
>
>
> --
> Michael Zingale
> Associate Professor
>
> Dept. of Physics & Astronomy • Stony Brook University • Stony Brook, NY
> 11794-3800
> *phone*:  631-632-8225
> *e-mail*: Michael.Zingale at stonybrook.edu
> *web*: http://www.astro.sunysb.edu/mzingale
>
> _______________________________________________
> 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/20140116/4de45600/attachment.html>


More information about the yt-users mailing list