[ncl-talk] Reduce white space in the plot
Mary Haley
haley at ucar.edu
Mon Sep 28 08:54:50 MDT 2015
[The original message I sent didn't go through because my attachments were
too large. I had to reject my own posting! I'm reposting my answer with
fewer attachments and some cleanup of my original response.]
Debasish,
Since you chose a 2 x 4 (2 rows by 4 columns) configuration for your plot,
you are pretty much taking up all the possible space in the width that you
have available.
There are a few ways to make your plots bigger:
- You are using a size of 2500 x 2500 for your PNG, which is a good
size. You can trim the white space by calling "convert -trim" on the PNG
after the panel plot has been drawn. You need to add this code at the end
of your script, before the "end" statement, but after the "frame" call:
delete(wks)
system("convert -trim Test_wspace.png Test_wspace.trim.png")
"convert" is part of ImageMagick. For information on downloading this free
tool, see
http://www.imagemagick.org/script/index.php
- Set gsnPanelYWhiteSpacePercent / gsnPanelXWhiteSpacePercent to
something smaller than 4. If you use a value of 0, then your plots will
almost be touching. I used a value of 1.0
- Use a configuration other than 2 x 4, like 4 x 2, or even 3 x 3, if
you don't mind having 2 rows of 3 plots, and then 1 row with 2 plots. But,
if you do this, I suggest not moving the labelbar so far away from the
paneled plots, because then you are decreasing the amount of space for
where you can put the plots. In general, I suggest not setting the
gsnPanelBottom/Top/Left/Right resources, unless you need to for other
reasons, like doing multiple panels on one page.
See the modified script, which uses dummy data, and the attached PNG images
(both non-trimmed and trimmed), which I generated by using a value of 1.0
for the "WhiteSpacePercent" resources, and by doing a "convert -trim" after
the image was created. I also removed the white space before the labelbar,
but you don't need to do this. I made the original PNG 1500x1500 to make
the attachment a little smaller.
--Mary
On Sat, Sep 26, 2015 at 3:12 PM, Debasish Hazra <debasish.hazra5 at gmail.com>
wrote:
> Hi,
>
> I am trying to plot a panel plot with 8 figures. However, it seems the
> final plot shows lot of white spaces and figure sizes are small. Is there
> any way I can increase the sizes of the each figure to cover more part of
> the panel ? Attached is the code and the resulted figure.
>
> Thanks
> Debasish.
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150928/47b6096c/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_space_modified.ncl
Type: application/octet-stream
Size: 4553 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150928/47b6096c/attachment-0001.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Test_wspace_24.png
Type: image/png
Size: 243805 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150928/47b6096c/attachment-0002.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Test_wspace_24.trim.png
Type: image/png
Size: 234046 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150928/47b6096c/attachment-0003.png
More information about the ncl-talk
mailing list