[ncl-talk] Getting specific point size text on NCL figures
Matichuk, Rebecca
Matichuk.Rebecca at epa.gov
Thu Aug 3 11:27:00 MDT 2017
One more detail…when I used the convert/trim flags, I was using “.pdf” and not “.png”
Thanks,
Rebecca
303-312-6867
From: Matichuk, Rebecca
Sent: Thursday, August 3, 2017 11:26 AM
To: 'Mary Haley' <haley at ucar.edu>
Cc: ncl-talk at ucar.edu
Subject: RE: Getting specific point size text on NCL figures
Thanks so much Mary! I did receive an email from Rick Brownrigg about an option for font size (excerpted below). I also forgot to note that I also have specified the “convert” and “trim” flags but still have problems (line excerpted below). So, should I remove all the line copied below and just use the convert and trim flags? I don’t think that will do the trick because I think I start with just convert and trim and then found the other options online to minimize the white space.
Thanks,
Rebecca
303-312-6867
Convert and Trim:
system("convert -density 188 -trim " + plot_name + ".png" + " " + plot_name + ".png")
Font Size:
As you may know, there are 72 points per inch, so an 8pt font would be 8/72 = .1111 inches. However, font size in NCL is measured in NDC space, which is a unit square area mapped to the longest dimension of your plot. So you'd need to know the size in inches of your plot to find the right factor. If for example you are plotting to PDF output on an 8"x11" page, then an inch in NDC space is 1/11 = .0909 ndc/in. So I get a font size of .1111 x .0909 about .01 ndc
From: Mary Haley [mailto:haley at ucar.edu]
Sent: Thursday, August 3, 2017 11:15 AM
To: Matichuk, Rebecca <Matichuk.Rebecca at epa.gov<mailto:Matichuk.Rebecca at epa.gov>>
Cc: ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>
Subject: Getting specific point size text on NCL figures
Hi Rebecca,
Unfortunately there's no easy way to get a specific point size of text in NCL. This has been on our "to do" list for awhile, but it is not a trivial feature to implement.
Since I don't have experience with this, I'm CC ncl-talk to see if anybody out there has gotten creative with getting a specific point size of text on their NCL figures. I know some people have simply not drawn any text using NCL, and instead use some post-processing program like Adobe Illustrator to add their own text at a specific font. You could even use PowerPoint to do something like this.
As for the PNG to PDF, I would recommend using "convert" with the "-trim" option to post process the PNG or PDF images and trim off the white space. Please see our FAQ question on this:
http://www.ncl.ucar.edu/FAQ/#o_formats_003
--Mary
On Thu, Aug 3, 2017 at 9:24 AM, Matichuk, Rebecca <Matichuk.Rebecca at epa.gov<mailto:Matichuk.Rebecca at epa.gov>> wrote:
Hi Mary,
You have helped me with NCL issues in the past so I thought I’d reach out to you again. I’m having issues with asking/sending questions through ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>. I’ve received auto-generated emails stating that I cannot contribute to this list and “bounce” responses. Could you help me figure out why because I’m needing some help generating some figures. I’ve outlined my questions below in case you can help me in the meantime.
Thanks so much!
Rebecca
1. I’m generating figures for an academic journal and one of the requirements is for the font size to be 8 points. What is the equivalent to 8 points in NCL?
2. I’m also having problems converting my original png files to pdfs, where I had a lot of white space around the single and panel figures. I’ve been working with the following resources, but it’s been a challenge. Any suggestions to make the conversion easier?
wks_type = "pdf"
wks_type at wkPaperSize = "landscape"
wks1 = gsn_open_wks(wks_type, plot_name)
gsn_define_colormap(wks1, "gui_default")
plot = new(nplot,graphic)
plot_overlay = new(nplot,graphic)
res = True ; plot mods desired
res at gsnDraw = False
res at gsnFrame = False
res at gsnMaximize = True
res at gsnPaperOrientation = "landscape"
res at gsnPaperMargin = 0.07
resB = True
resB at gsnPanelFigureStringsFontHeightF = 0.010
resB at gsnPanelFigureStrings = site_name
resB at gsnPanelYF = (/0.83,0.83,-1,-1/) ;tr,br,tl,bl
resB at gsnPanelXF = (/0.06,0.55,0.06,0.55/)
resB at amJust = "TopLeft"
res at vpWidthF = 14.0 ; plot size (width)
res at vpHeightF = 10.74 ; plot size (height)
; res at vpXF = 0.02 ; location of plot(0)
res at vpYF = 0.88 ; location of plot(0)
Rebecca
303-312-6867<tel:(303)%20312-6867>
From: Mary Haley [mailto:haley at ucar.edu<mailto:haley at ucar.edu>]
Sent: Wednesday, February 22, 2017 10:09 AM
To: Matichuk, Rebecca <Matichuk.Rebecca at epa.gov<mailto:Matichuk.Rebecca at epa.gov>>
Cc: ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>
Subject: Re: FW: Legend to draw on top of grid lines
In order to post a question to ncl-talk, you must first subscribe to it.
Please see this page to subscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Once you subscribe, you should receive an automated email right away that you need to respond to in order for the subscription to go through. If you don't receive this automated email, then please check your spam box.
Once you respond to the automated email, you should be able to send your question again to ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>.
In order to get the leg_10 plot to work in a panel, I would use the powerful "overlay" call to make one plot a part of the other. That way, when you draw the base plot, you will get both plots.
See the (hurriedly) created leg_10.ncl example that now does a panel. I didn't have time to come up with "nice" looking dummy Y curves, so I just changed a few values to get something out quickly.
You may also want to look at the "simple_legend" function which is mentioned on the same page. It should be much easier to create a legend with this function.
--Mary
On Tue, Feb 21, 2017 at 12:41 PM, Matichuk, Rebecca <Matichuk.Rebecca at epa.gov<mailto:Matichuk.Rebecca at epa.gov>> wrote:
Hi,
I received the email below stating that my email to the NCL help emailing list has been rejected. I'm not sure why, but would you be able to help me?
Thanks,
Rebecca
303-312-6867<tel:303-312-6867>
-----Original Message-----
From: ncl-talk-bounces at ucar.edu<mailto:ncl-talk-bounces at ucar.edu> [mailto:ncl-talk-bounces at ucar.edu<mailto:ncl-talk-bounces at ucar.edu>] On Behalf Of ncl-talk-owner at ucar.edu<mailto:ncl-talk-owner at ucar.edu>
Sent: Tuesday, February 21, 2017 6:45 AM
To: Matichuk, Rebecca <Matichuk.Rebecca at epa.gov<mailto:Matichuk.Rebecca at epa.gov>>
Subject: Legend to draw on top of grid lines
You are not allowed to post to this mailing list, and your message has been automatically rejected. If you think that your messages are being rejected in error, contact the mailing list owner at ncl-talk-owner at ucar.edu<mailto:ncl-talk-owner at ucar.edu>.
=====================================
Hi,
I'm trying to generate a panel plot where the legends are not transparent and on top of grid lines. I found this example at the link included below. However, it is for a single figure and I cannot get it to work for the panel plotting. By trying to following the NCL example, my legends just disappear. What should I alter in this example from the NCL website to get it to work for a panel plot that:
1. NCL version: 6.2.1
2. 2x3 panel
3. Uses plot(iplot) = gsn_csm_xy(wks1,xplot,yplot,res)
4. Uses gsn_panel(wks1,plot,(/row_plot,col_plot/),resB)
5. GNU/Linux system
https://www.ncl.ucar.edu/Applications/Scripts/leg_10.ncl
Thank you,
Rebecca
---------- Forwarded message ----------
From: "Matichuk, Rebecca" <Matichuk.Rebecca at epa.gov<mailto:Matichuk.Rebecca at epa.gov>>
To: "ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>" <ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>>
Cc:
Date: Tue, 21 Feb 2017 13:45:18 +0000
Subject: Legend to draw on top of grid lines
Hi,
I’m trying to generate a panel plot where the legends are not transparent and on top of grid lines. I found this example at the link included below. However, it is for a single figure and I cannot get it to work for the panel plotting. By trying to following the NCL example, my legends just disappear. What should I alter in this example from the NCL website to get it to work for a panel plot that:
1. NCL version: 6.2.1
2. 2x3 panel
3. Uses plot(iplot) = gsn_csm_xy(wks1,xplot,yplot,res)
4. Uses gsn_panel(wks1,plot,(/row_plot,col_plot/),resB)
5. GNU/Linux system
https://www.ncl.ucar.edu/Applications/Scripts/leg_10.ncl
Thank you,
Rebecca
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170803/2565d98c/attachment.html
More information about the ncl-talk
mailing list