[yt-users] PlotCollection

Nathan Goldbaum nathan12343 at gmail.com
Wed Jan 13 12:52:01 PST 2016


On Wed, Jan 13, 2016 at 2:13 PM, Junhwan Choi (최준환) <choi.junhwan at gmail.com>
wrote:

> Hi Nathan,
>
> Thank you for your advice.
> I try to replace PlotCollection to SlicePlot and I got error.
> I find that I have to pass the normal vector and field name when I
> call the SlicePlot/ProjectionPlot from the beginning unlike the
> PlotCollection..
> It looks like that it limit the SlicePlot get only one perspective at
> once in the multi plot.
> [Am I correct?]
> However, as you see my script, I would like to show three different
> perspective at once and it was done by add_slice to PlotCollection
> previously.
> In addition, if this is the case, I cannot make multi plot mixed with
> slice and projection.
> It looks like that replacing  the PlotCollection  simply SlicePlot and
> ProjectionPlot limit the potability of yt…..
> There should be other way to go…..
>

So I'm not very familiar with the eps writer (John Wise added this
functionality added the ability to use SlicePlot and ProjectionPlot), so
take what I'm saying worth a grain of salt.

I think the solution is to pass in multiple different SlicePlot and
ProjectionPlot instances.

See this page in the docs:

http://yt-project.org/doc/visualizing/plots.html#publication-ready-figures

Unfortunately I won't have time to look into this more closely in the next
day or two.


>
> Thank you,
> Junhwan
>
>
>
>
> On Wed, Jan 13, 2016 at 1:52 PM, Nathan Goldbaum <nathan12343 at gmail.com>
> wrote:
> > SlicePlot and ProjectionPlot should work with the eps_writer.
> >
> >
> > On Wednesday, January 13, 2016, Junhwan Choi (최준환) <
> choi.junhwan at gmail.com>
> > wrote:
> >>
> >> Hi yt user,
> >>
> >> I have old yt script (with yt-2.7-ish) with eps_writer module that
> >> makes 3x3 multi panel slice plot as follow
> >> =================================
> >> import matplotlib as matplotlib
> >> matplotlib.use('Agg')
> >> import matplotlib.pylab as pylab
> >> from yt.mods import *
> >> import yt.visualization.eps_writer as eps
> >> import pyx
> >> import pylab as pl
> >>
> >> pl.ion()
> >> pl.clf()
> >>
> >> # load up a dataset
> >> LBOX1 = 4000
> >> LBOX2 = 4
> >> LBOX3 = 0.04
> >>
> >> index = 66
> >> pf = load("../DD%04d/DD%04d" % (index,index))
> >> den_center = pf.h.find_max("Density")[1]
> >> # create density slices
> >> pc = PlotCollection(pf, center=den_center)
> >>
> >> p1 =pc.add_slice("Density", "z", center=den_center, use_colorbar=False)
> >> p2 =pc.add_slice("Density", "x", center=den_center, use_colorbar=False)
> >> p3 =pc.add_slice("Density", "y", center=den_center, use_colorbar=False)
> >>
> >> p1.set_zlim(1e-27, 1e-20)
> >> p2.set_zlim(1e-27, 1e-20)
> >> p3.set_zlim(1e-27, 1e-20)
> >>
> >> p4 =pc.add_slice("Density", "z",center=den_center, use_colorbar=False)
> >> p5 =pc.add_slice("Density", "x",center=den_center, use_colorbar=False)
> >> p6 =pc.add_slice("Density", "y",center=den_center, use_colorbar=False)
> >>
> >> p4.set_zlim(2e-20, 2e-14)
> >> p5.set_zlim(2e-20, 2e-14)
> >> p6.set_zlim(2e-20, 2e-14)
> >>
> >> p7 =pc.add_slice("Density", "z",center=den_center, use_colorbar=False)
> >> p8 =pc.add_slice("Density", "x",center=den_center, use_colorbar=False)
> >> p9 =pc.add_slice("Density", "y",center=den_center, use_colorbar=False)
> >>
> >> p7.set_zlim(2e-16, 2e-10)
> >> p8.set_zlim(2e-16, 2e-10)
> >> p9.set_zlim(2e-16, 2e-10)
> >>
> >> p1.set_width(LBOX1,"pc")
> >> p2.set_width(LBOX1,"pc")
> >> p3.set_width(LBOX1,"pc")
> >>
> >> p4.set_width(LBOX2,"pc")
> >> p5.set_width(LBOX2,"pc")
> >> p6.set_width(LBOX2,"pc")
> >>
> >> p7.set_width(LBOX3,"pc")
> >> p8.set_width(LBOX3,"pc")
> >> p9.set_width(LBOX3,"pc")
> >>
> >> ep = eps.multiplot_yt(3,3,pc,bare_axes = True)
> >> ep.title_box("xy", loc=(0.1,2.95))
> >> ep.title_box("yz", loc=(1.1,2.95))
> >> ep.title_box("xz", loc=(2.1,2.95))
> >> ep.scale_line(label="%6.0f kpc" % (LBOX1/4000.0), size=0.25,
> >> linewidth=pyx.style.linewidth.Thick, loc=(0.05,3.08))
> >> ep.scale_line(label="%6.0f pc"  % (LBOX2/4.0)   , size=0.25,
> >> linewidth=pyx.style.linewidth.Thick, loc=(0.05,2.08))
> >> ep.scale_line(label="%6.2f pc"  % (LBOX3/4.0)   , size=0.25,
> >> linewidth=pyx.style.linewidth.Thick, loc=(0.05,1.08))
> >> ep.save_fig("VelDenSlice4R_%04d"  % (index) )
> >> pl.clf()
> >> ==================================
> >>
> >> And, now I would like to port to the latest yt.
> >> I could make most of changes but I found that there is no
> >> PlotCollection which can pass the figures to eps.multiplot_yt any
> >> more.
> >> Is there any alternative way to replace the what PlotCollection and
> >> add_slice did?
> >> I also need to include the annotate_xxx so that using imshow is not a
> >> good option for me.
> >>
> >> Thanks in advance,
> >> Junhwan Choi
> >> _______________________________________________
> >> 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
> >
> _______________________________________________
> 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/20160113/0aef1ed0/attachment.htm>
-------------- next part --------------
_______________________________________________
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