<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. </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 ;; took a lot of digging to find this one. </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, </div><div class="">><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 values.” </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> </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. </div><div class="">That will fill the png horizontally but leave you with white space at the top and bottom. You can then use “-trim" or “-shave 0x261” (assuming an 844 image height) to crop that border top and bottom. Don’t think there’s a way to produce rectangular plots without white space being included. </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. </div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Good luck, </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. </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 </font></div><div class=""><font face="Andale Mono" class="">wkst@wkHeight = wkst@wkWidth </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 = "Corners" </font><span style="font-family: 'Andale Mono';" class="">;;; use a cropped area just to 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. </span></div><div class=""><font face="Andale Mono" class="">mpres@mpProjection = "mercator"</font></div><div class=""><font face="Andale Mono" class="">mpres@mpPerimOn = False </font></div><div class=""><font face="Andale Mono" class="">mpres@mpLeftCornerLonF = -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 = 0</font></div><div class=""><font face="Andale Mono" class=""><br class=""></font></div><div class=""><font face="Andale Mono" class="">mpres@tmXTOn = 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>;;; </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="">;;; 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=""> "vpHeightF": vpHF</font></div><div class=""><font face="Andale Mono" class=""> "vpWidthF": vpWF ;; should be 1.</font></div><div class=""><font face="Andale Mono" class="">end getvalues</font></div><div class=""><font face="Andale Mono" class=""> </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) ;; 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 Environmental Sciences,<br class="">University at Albany, State University of New York, 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 <<a href="mailto:rousslucas@gmail.com" class="">rousslucas@gmail.com</a>> 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=""> Here is the piece of code :</div><div class=""><br class=""></div><div class=""> waveheight = fin->HTSGW_P0_L1_GLL0</div><div class=""> delete(waveheight@long_name)</div><div class=""> delete(waveheight@units)</div><div class=""><br class=""></div><div class=""> wavedir = fin->DIRPW_P0_L1_GLL0</div><div class=""> delete(wavedir@long_name)</div><div class=""> delete(wavedir@units)</div><div class=""><br class=""></div><div class=""> wks_type = "png"</div><div class=""> wks_type@wkWidth = 1366</div><div class=""> wks_type@wkHeight = 844</div><div class=""> wks = gsn_open_wks(wks_type,outfile)</div><div class=""> </div><div class=""> vres = True<br class=""></div><div class=""> vres@vcRefAnnoOn = False</div><div class=""><br class=""></div><div class=""> res = True</div><div class=""> res@gsnMaximize = True</div><div class=""> res@lbLabelBarOn = False</div><div class=""> res@lbTitleOn = False</div><div class=""> vres@lbLabelBarOn = False</div><div class=""> vres@lbTitleOn = False</div><div class=""><br class=""></div><div class=""> plot = gsn_csm_contour_map(wks,waveheight,res)</div><div class=""> plot_ov = gsn_csm_vector_scalar(wks, udir(:,:), vdir(:,:),waveheight,vres)</div><div class=""><br class=""></div><div class=""> overlay(plot,plot_ov) ; overlay the U-wind plot on the temperature plot</div><div class=""><br class=""></div><div class=""> draw(plot) ; draw the temperature plot (with the U-wind plot overlaid)</div><div class=""> frame(wks) ; 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"><out.png></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>