<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">There a couple tricks to do this, and I don’t think a complete example anywhere so not sure where it would go though.&nbsp;</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Key resources to really fill a png.</div><div class=""><font face="Andale Mono" class="">res@gsnMaximize = True</font></div><div class=""><font face="Andale Mono" class="">res@gsnBoxMargin = 0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;; took a lot of digging to find this one.&nbsp;</font><a href="https://www.ncl.ucar.edu/Document/Graphics/Resources/gsn.shtml#gsnBoxMargin" class="">https://www.ncl.ucar.edu/Document/Graphics/Resources/gsn.shtml#gsnBoxMargin</a></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Key things to remember,&nbsp;</div><div class="">&gt;<span class="Apple-tab-span" style="white-space:pre">        </span>"because NCL always draws its graphics to a square canvas, the PNG image will be resized to a square, using the largest of the two values, if you give it non-square&nbsp;values.”&nbsp;</div><div class=""><span class="Apple-tab-span" style="white-space:pre">                </span><a href="https://www.ncl.ucar.edu/Applications/resize.shtml" class="">https://www.ncl.ucar.edu/Applications/resize.shtml</a>&nbsp;</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">So if you want it 1366 wide set both wkWidth and wkHeight to 1366.&nbsp;</div><div class="">That will fill the png horizontally but leave you with white space at the top and bottom. &nbsp;You can then use “-trim" or “-shave 0x261” &nbsp;(assuming an 844 image height) to crop that border top and bottom. &nbsp;Don’t think there’s a way to produce rectangular plots without white space being included. &nbsp;&nbsp;</div><div class=""><br class=""></div><div class="">I put a couple of lines at the bottom that should work out the white space and trim it off by itself. &nbsp;</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Good luck,&nbsp;</div><div class=""><br class=""></div><div class="">Alan</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">e.g. with different map coords so different shave numbers.&nbsp;</div><div class=""><br class=""></div><div class=""><div class=""><font face="Andale Mono" class="">wkst = "png"</font></div><div class=""><font face="Andale Mono" class="">wkst@wkWidth = 1366&nbsp;</font></div><div class=""><font face="Andale Mono" class="">wkst@wkHeight = wkst@wkWidth&nbsp;</font></div><div class=""><font face="Andale Mono" class="">outputname = "filled_png"</font></div><div class=""><font face="Andale Mono" class=""><br class=""></font></div><div class=""><font face="Andale Mono" class="">wks = gsn_open_wks(wkst,outputname)</font></div><div class=""><font face="Andale Mono" class="">mpres := True</font></div><div class=""><font face="Andale Mono" class="">mpres@mpLimitMode &nbsp; &nbsp; &nbsp; = "Corners" &nbsp; &nbsp;&nbsp;</font><span style="font-family: 'Andale Mono';" class="">;;; use a cropped area just to&nbsp;identify</span><span class="Apple-tab-span" style="font-family: 'Andale Mono'; white-space: pre;">        </span><span style="font-family: 'Andale Mono';" class="">the edge of the plot.&nbsp;</span></div><div class=""><font face="Andale Mono" class="">mpres@mpProjection &nbsp; &nbsp; &nbsp;= "mercator"</font></div><div class=""><font face="Andale Mono" class="">mpres@mpPerimOn &nbsp; &nbsp; &nbsp; &nbsp; = False &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</font></div><div class=""><font face="Andale Mono" class="">mpres@mpLeftCornerLonF &nbsp;= -100</font></div><div class=""><font face="Andale Mono" class="">mpres@mpRightCornerLonF = 100</font></div><div class=""><font face="Andale Mono" class="">mpres@mpRightCornerLatF = 60</font></div><div class=""><font face="Andale Mono" class="">mpres@mpLeftCornerLatF &nbsp;= 0</font></div><div class=""><font face="Andale Mono" class=""><br class=""></font></div><div class=""><font face="Andale Mono" class="">mpres@tmXTOn &nbsp;= False<span class="Apple-tab-span" style="white-space:pre">                </span></font><span style="font-family: 'Andale Mono';" class="">;;; Here and below are the only ones that actually matter</span></div><div class=""><font face="Andale Mono" class="">mpres@tmXBOn = False<span class="Apple-tab-span" style="white-space:pre">                </span></font></div><div class=""><font face="Andale Mono" class="">mpres@tmYROn = False</font></div><div class=""><font face="Andale Mono" class="">mpres@tmYLOn = False</font></div><div class=""><font face="Andale Mono" class=""><br class=""></font></div><div class=""><font face="Andale Mono" class="">mpres@gsnMaximize= True<span class="Apple-tab-span" style="white-space:pre">                </span>;;;&nbsp;</font></div><div class=""><font face="Andale Mono" class="">mpres@gsnBoxMargin = 0<span class="Apple-tab-span" style="white-space:pre">                </span></font><span style="font-family: 'Andale Mono';" class="">;;; &nbsp;this one is the key one to really fill the png</span></div><div class=""><font face="Andale Mono" class="">plot = gsn_csm_map(wks, mpres)</font></div><div class=""><font face="Andale Mono" class=""><br class=""></font></div><div class=""><font face="Andale Mono" class="">getvalues plot</font></div><div class=""><font face="Andale Mono" class="">&nbsp; &nbsp; "vpHeightF": vpHF</font></div><div class=""><font face="Andale Mono" class="">&nbsp; &nbsp; "vpWidthF": vpWF &nbsp; ;; should be 1.</font></div><div class=""><font face="Andale Mono" class="">end getvalues</font></div><div class=""><font face="Andale Mono" class="">&nbsp;</font></div><div class=""><font face="Andale Mono" class="">image_height = 1366*vpHF</font></div><div class=""><font face="Andale Mono" class="">half_margin = floor(0.5* (wkst@wkHeight-image_height) )</font></div><div class=""><font face="Andale Mono" class=""><br class=""></font></div><div class=""><font face="Andale Mono" class="">;system("convert -shave 0x"+half_margin+" "+outputname+"."+wkst+" shaved.png")</font></div><div class=""><font face="Andale Mono" class="">;; or</font></div><div class=""><font face="Andale Mono" class="">system("mogrify -shave 0x"+half_margin+" "+outputname+"."+wkst) &nbsp;;; sister to convert, replaces original image</font></div></div><div class=""><font face="Andale Mono" class=""><br class=""></font></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span class="Apple-style-span" style="border-collapse: separate; font-variant-ligatures: normal; font-variant-east-asian: normal; font-variant-position: normal; line-height: normal; border-spacing: 0px;"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">##############################<br class="">Alan Brammer,<div class="">Post-Doc Researcher</div><div class=""><br class=""></div><div class="">Department of Atmospheric and&nbsp;Environmental Sciences,<br class="">University at Albany,&nbsp;State University of New&nbsp;York,&nbsp;Albany, NY, 12222<div class=""><a href="mailto:abrammer@albany.edu" class="">abrammer@albany.edu</a><br class="">##############################</div></div></div></span></div></div>
</div><div class=""><br class="webkit-block-placeholder"></div><div class=""><br class=""></div><div class=""><br class=""></div>
<br class=""><div><blockquote type="cite" class=""><div class="">On 22 May 2017, at 12:31, Roussan &lt;<a href="mailto:rousslucas@gmail.com" class="">rousslucas@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">Hello,</div><div class="">I would like to plot contours in full page at a given size (1366 x 844),</div><div class="">with no margins, no white spaces, just the plot at this dimmension.</div><div class="">Is it possible, or do I have to use imagemaick or graphicsmagick to crop the output image ?<br class=""></div><div class="">(I have disabled titles and labels.)</div><div class=""><br class=""></div><div class="">&nbsp;Here is the piece of code :</div><div class=""><br class=""></div><div class="">&nbsp; waveheight = fin-&gt;HTSGW_P0_L1_GLL0</div><div class="">&nbsp; delete(waveheight@long_name)</div><div class="">&nbsp; delete(waveheight@units)</div><div class=""><br class=""></div><div class="">&nbsp; wavedir &nbsp; &nbsp;= fin-&gt;DIRPW_P0_L1_GLL0</div><div class="">&nbsp; delete(wavedir@long_name)</div><div class="">&nbsp; delete(wavedir@units)</div><div class=""><br class=""></div><div class="">&nbsp; wks_type = "png"</div><div class="">&nbsp; wks_type@wkWidth = 1366</div><div class="">&nbsp; wks_type@wkHeight = 844</div><div class="">&nbsp; wks &nbsp;= gsn_open_wks(wks_type,outfile)</div><div class="">&nbsp;&nbsp;</div><div class="">&nbsp; vres &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = True<br class=""></div><div class="">&nbsp;&nbsp;vres@vcRefAnnoOn = False</div><div class=""><br class=""></div><div class="">&nbsp; res &nbsp;= True</div><div class="">&nbsp; res@gsnMaximize &nbsp; &nbsp; = True</div><div class="">&nbsp; res@lbLabelBarOn &nbsp; &nbsp;= False</div><div class="">&nbsp; res@lbTitleOn &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= False</div><div class="">&nbsp; vres@lbLabelBarOn &nbsp; = False</div><div class="">&nbsp; vres@lbTitleOn &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = False</div><div class=""><br class=""></div><div class="">&nbsp; plot = gsn_csm_contour_map(wks,waveheight,res)</div><div class="">&nbsp; plot_ov = gsn_csm_vector_scalar(wks, udir(:,:), vdir(:,:),waveheight,vres)</div><div class=""><br class=""></div><div class="">&nbsp; overlay(plot,plot_ov) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;; overlay the U-wind plot on the temperature plot</div><div class=""><br class=""></div><div class="">&nbsp; draw(plot) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;; draw the temperature plot (with the U-wind plot overlaid)</div><div class="">&nbsp; frame(wks) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; advance the frame</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">You will can see what I can achieve in attachement.</div><div class="">Thank you in advance</div><div class="">Ross.</div></div>
<span id="cid:0F98AF82-E0C3-4B46-B2DB-C4CA1A79F0B2@eas.albany.edu">&lt;out.png&gt;</span>_______________________________________________<br class="">ncl-talk mailing list<br class=""><a href="mailto:ncl-talk@ucar.edu" class="">ncl-talk@ucar.edu</a><br class="">List instructions, subscriber options, unsubscribe:<br class="">http://mailman.ucar.edu/mailman/listinfo/ncl-talk<br class=""></div></blockquote></div><br class=""></div></body></html>