Sorry, I was a bit confused: I read after I sent the last e-mail that you tested fig_size = (12,9), and that test with a different aspect ratio did not actually work for me. I will test better, or send more details on my script, in the next days. Cheers, Luigi On Wednesday 31 March 2010, Luigi Iapichino wrote:
Hi Matt,
your fix works, provided the plot is not smaller than 750x600 and the aspect ratio is 1.25:1 (thus allowing space for the colorbar). For smaller plots the label of the colorbar (whose font size does not scale) will go out of the figure. This is not a crucial issue to be fixed: I will simply stay above this threshold. Thanks for your help,
Luigi
On Wednesday 31 March 2010, Matthew Turk wrote:
Hi Luigi,
I think I have tracked it down. The issue only shows up when the aspect ratio of the axes object -- the image itself -- is not 1.0. What seems to have happened is that there is confusion in the contour callback object (as well as the grid boundary callback, so I would be unsurprised if you saw these same issues there) as to which axis is x and which is y. I believe this is my fault, dating back quite some time -- fortunately, as you point out, it's very obvious (and should result in broken contours at the edges.)
What tipped me off to this was your statement about the figure sizes -- this shouldn't be directly used, but instead only used indirectly via seeing how big (canvas-space) the axes object is inside the contouring code. Running with a fig_size like (20,16) that ensures aspect ratio of 1.0 in the axes object (allowing 20% for colorbar on the figure itself) worked, so that theory started to pan out. I have tested with fig_size = (12,9) as well, and this fix works.
If you could try changing lines 153 and 154 of yt/raven/Callbacks.py to be "dy =" and "dx =" instead of "dx =" and "dy =" that would be a great help. If that works for you, I'll commit it to the repository.
Thanks very much for this report, and I hope this works out.
-Matt
On Wed, Mar 31, 2010 at 1:53 AM, Luigi Iapichino
wrote: Hi Matt,
both methods work, but I have a further problem: if I try to add density contours, they appear in the plot, but they are not superimposed at the correct location. They look like shifted, and I suppose that
p.modify["contour"]("Density", ncont=5,take_log=True)
does not "see" that I changed the size of the figure. Am I missing something? Thanks,
Luigi
On Tuesday 30 March 2010, Matthew Turk wrote:
Hi Luigi,
Yup, you'll just need to provide it with a new "figure". In matplotlib, figures are the background - the entire image, if you will - and "axes" are individual plot elements on that. Here we're going to create a figure with 100 dpi that's 12 inches by 9 inches -- this should be 1200 by 900 pixels:
fig = raven.matplotlib.figure.Figure(dpi = 100, figsize = (12, 9)) p = pc.add_projection("Temperature", 0, weight_field="Density")
That's the slightly harder way -- you'll have to generate a new Figure object for every plot. There's a shortcut in yt already, though, that accepts a figsize=(width, height) argument, where width and height are in inches:
p = pc.add_projection("Temperature", 0, weight_field="Density", fig_size=(20, 16))
if you wanted 2000 by 1600 pixels.
Does that help out?
Best,
Matt
On Tue, Mar 30, 2010 at 7:47 AM, Luigi Iapichino
wrote: Dear all,
in one of my scripts I have something like this:
pc = PlotCollection(pf, center=[0.5,0.5,0.5])
p = pc.add_projection("Temperature", 0, weight_field="Density") p.modify["contour"]("Density", ncont=5, take_log=True) ... ... ... pc.save("%s_temp-proj" % pf,override=True)
The saved file has a resolution of 800x800. Is there a way to change this number in YT? I had a look in the PlotCollection class, but I haven't found what I'm searching.
Looking forward to your suggestions, Cheers
Luigi
--
---------------------------------------------------------------
Luigi Iapichino Zentrum fuer Astronomie der Universitaet Heidelberg Institut fuer Theoretische Astrophysik Albert-Ueberle-Str. 2, D-69120 Heidelberg, Germany Tel: +49 6221 548983, Fax: +49 6221 544221 e-mail: luigi@ita.uni-heidelberg.de URL: http://www.ita.uni-heidelberg.de/~luigi/ _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
--
---------------------------------------------------------------
Luigi Iapichino Zentrum fuer Astronomie der Universitaet Heidelberg Institut fuer Theoretische Astrophysik Albert-Ueberle-Str. 2, D-69120 Heidelberg, Germany Tel: +49 6221 548983, Fax: +49 6221 544221 e-mail: luigi@ita.uni-heidelberg.de URL: http://www.ita.uni-heidelberg.de/~luigi/ _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- --------------------------------------------------------------- Luigi Iapichino Zentrum fuer Astronomie der Universitaet Heidelberg Institut fuer Theoretische Astrophysik Albert-Ueberle-Str. 2, D-69120 Heidelberg, Germany Tel: +49 6221 548983, Fax: +49 6221 544221 e-mail: luigi@ita.uni-heidelberg.de URL: http://www.ita.uni-heidelberg.de/~luigi/