[yt-users] unnecessary margin between multi panels with eps_writer

Wise, John H jwise at physics.gatech.edu
Wed Jan 20 03:52:18 PST 2016


Hi Junhwan and Nathan,

I can confirm that this is a bug.  It’s a pretty serious plotting artifact, arising from a mismatch of the sub-panel boundaries and plot size.  I suspect that it might come from changes in PlotWindow, but that’s only a guess.  

My plate is pretty full for the rest of the week, but I can look at it after that.

Thanks,
John

> On 19 Jan 2016, at 21:40, Nathan Goldbaum <nathan12343 at gmail.com> wrote:
> 
> Hi Junhwan,
> 
> So I think this is a bug in the eps writer. I was able to adopt your script somewhat to make it runnable using one of the public test datasets on yt-project.org/data:
> 
> http://paste.yt-project.org/show/6173/
> 
> With the following modification to the eps_writer, I'm able to at least make the margins between the plots along the y-axis go away:
> 
> http://paste.yt-project.org/show/6174/
> 
> The image looks like this:
> 
> http://imgur.com/E0uzPCh
> 
> Unfortunately, the eps writer is pretty complicated, and I don't really know anything about pyx, so it's hard for me to reason about what's going on in here. There's something wrong with how the plot positions are being determined, but I'm not sure what it is...
> 
> Sorry to not have a more definitive answer. If you're able to figure out what's going wrong, I'm sure a pull request with a fix would be very welcome.
> 
> -Nathan
> 
> On Tue, Jan 19, 2016 at 9:14 AM, Junhwan Choi (최준환) <choi.junhwan at gmail.com> wrote:
> Hi yt user,
> 
> I try to make a multi panels plot with eps_writer modules.
> I use following script and it works with one unpleasant shortcoming.
> ==================================================
> import matplotlib as matplotlib
> matplotlib.use('Agg')
> import numpy as np
> import matplotlib.pylab as pylab
> import yt
> import yt.units as units
> import yt.visualization.eps_writer as eps
> import pyx
> 
> index = 60
> ds = yt.load('../DD%04d/DD%04d' % (index,index))
> ds.add_particle_filter('sink')
> ad = ds.all_data()
> center = ds.find_max(('gas', 'density'))[1]
> 
> # scale and limit
> LBox = [4000, 4]
> 
> plot_list = []
> for nrow in range(0,2):
>     for norm in 'zxy':
>         pc =yt.SlicePlot(ds, norm, ('gas', 'density'), center=center)
>         pc.set_width(LBox[nrow],"pc")
>         plot_list.append(pc)
> 
> ep = eps.multiplot(ncol=3, nrow=2, yt_plots=plot_list, bare_axes = True)
> ep.title_box("xy", loc=(0.1,1.95))
> ep.title_box("yz", loc=(1.1,1.95))
> ep.title_box("xz", loc=(2.1,1.95))
> ep.scale_line(label="%6.0f kpc" % (LBox[0]/4000.0), size=0.25,
> linewidth=pyx.style.linewidth.Thick, loc=(0.05,1.08))
> ep.scale_line(label="%6.0f pc"  % (LBox[1]/4.0)   , size=0.25,
> linewidth=pyx.style.linewidth.Thick, loc=(0.05,0.08))
> ep.save_fig("multi_plot")
> ==================================================
> 
> Here, I attach the resulting plot.
> Everything is fine except there are white spacing/margin between panels.
> Is there any way to remove the white spacing/margin?
> 
> Thanks in advance,
> Junhwan
> 
> _______________________________________________
> 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

-- 
John Wise
Assistant Professor of Physics
Center for Relativistic Astrophysics, Georgia Tech
http://cosmo.gatech.edu

_______________________________________________
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