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

Nathan Goldbaum nathan12343 at gmail.com
Tue Jan 19 18:40:11 PST 2016


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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20160119/400c8a99/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