[ncl-talk] circular polymarker woes

Mary Haley haley at ucar.edu
Wed Aug 2 12:07:02 MDT 2017


Matt,

We also have an example showing how to create your circles, in case you
need to do this.

Please see polyg_21.ncl, which was contributed by Arindam Chakraborty:

http://www.ncl.ucar.edu/Applications/polyg.shtml#ex21

I added the one I just created as polyg_22.ncl.

--Mary


On Tue, Aug 1, 2017 at 9:24 AM, Matt Flournoy <mflournoy37 at gmail.com> wrote:

> Thank you, Mary! That index looks great.
>
> Best,
> Matt
>
> On Mon, Jul 31, 2017 at 4:59 PM, Mary Haley <haley at ucar.edu> wrote:
>
>> Hi Matt,
>>
>> Instead of using index 4 in the marker table, you can create your own
>> marker using any one of our font tables. Some of these were drawn with
>> higher resolution.
>>
>> For example, click over to our font tables page:
>>
>> http://www.ncl.ucar.edu/Document/Graphics/font_tables.shtml
>>
>> and click on font table 37:
>>
>> http://www.ncl.ucar.edu/Document/Graphics/Images/font37.png
>>
>> Letter R is a hollow circle that might work for you.
>>
>> To use it, call:
>>
>>   icirc  = NhlNewMarker(wks,"R",37,0.,0.,1.,1.,0.)
>>
>> and then use that as your marker index:
>>
>>   gsres at gsMarkerIndex = icirc
>> See the attached script, which displays the two types of circles
>> side-by-side.
>>
>> Font table 19 also has some hollow circles you can try.
>>
>> --Mary
>>
>>
>> On Mon, Jul 31, 2017 at 9:56 AM, Matt Flournoy <mflournoy37 at gmail.com>
>> wrote:
>>
>>> Hi all,
>>>
>>> I'm having a minor problem plotting a circular polymarker. I'm using
>>> index=4 for the marker index, which should be a hollow circle, but when I
>>> plot it larger than ~ 0.03 the shape starts to deteriorate into a 16-sided
>>> polygon. Is there a way to ensure that the circular marker retains its
>>> shape when it is plotted larger than normal? I've attached a .png of the
>>> figure I'm trying to create, and here is the snippet of code that deals
>>> with the portion of the plot that I'm having problems with:
>>>
>>> *******************
>>>
>>>   ;-------
>>>   ; Create the index for the hollow, circle marker.
>>>   ;-------
>>>
>>> ;  mstring = "x" ; <-- default for hollow circle
>>> ;  fontnum = 19
>>> ;  xoffset = 0.0
>>> ;  yoffset = 0.075
>>> ;  ratio = 1.3125
>>> ;  size = 1.2
>>> ;  angle = 0.0
>>> ;
>>> ;  new_index = NhlNewMarker(xwks, mstring, fontnum, xoffset, yoffset,
>>> ratio, size, angle)
>>>
>>>   cn1_x = 0.84
>>>   cn1_y = 0.20
>>>
>>>   text_cn1 = "0.01"
>>>
>>>   cn_res1 = True
>>>   cn_res1 at gsMarkerColor = cn_color
>>>   cn_res1 at gsLineColor = cn_color
>>>   cn_res1 at gsMarkerIndex = 4 ; <-- open circle
>>>   cn_res1 at gsMarkerSizeF = 0.10
>>>   cn_res1 at gsLineThicknessF = 3
>>>   cn_res1 at gsMarkerThicknessF = 3
>>>   cn_res1 at gsFontQuality = "High"
>>>
>>>   cn_res1_text = True
>>>   cn_res1_text at txFontHeightF = 0.008
>>>   cn_res1_text at txFontColor   = cn_color
>>>   cn_res1_text at txBackgroundFillColor = "white"
>>>
>>>   gsn_polymarker_ndc(xwks,cn1_x,cn1_y,cn_res1)
>>>   gsn_text_ndc      (xwks,text_cn1,cn1_x + (cn_res1 at gsMarkerSizeF
>>> /2),cn1_y,cn_res1_text)
>>>
>>>   ;-------
>>>
>>>   offset = 0.03
>>>
>>>   cn2_x = cn1_x - offset + 0.02
>>>   cn2_y = cn1_y
>>>
>>>   text_cn2 = "0.02"
>>>
>>>   cn_res2 = True
>>>   cn_res2 at gsMarkerColor = cn_color
>>>   cn_res2 at gsLineColor = cn_color
>>>   cn_res2 at gsMarkerIndex = 4 ; <-- open circle
>>>   cn_res2 at gsMarkerSizeF = cn_res1 at gsMarkerSizeF - offset
>>>   cn_res2 at gsLineThicknessF = 3
>>>   cn_res2 at gsMarkerThicknessF = 3
>>>   cn_res2 at gsFontQuality = "High"
>>>
>>>   cn_res2_text = True
>>>   cn_res2_text at txFontHeightF = cn_res1_text at txFontHeightF
>>>   cn_res2_text at txFontColor   = cn_color
>>>   cn_res2_text at txBackgroundFillColor = "white"
>>>
>>>   gsn_polymarker_ndc(xwks,cn2_x,cn2_y,cn_res2)
>>>   gsn_text_ndc      (xwks,text_cn2,cn2_x + (cn_res2 at gsMarkerSizeF
>>> /2),cn2_y,cn_res2_text)
>>>
>>>   ;-------
>>>
>>>   cn3_x = cn2_x - offset + 0.02
>>>   cn3_y = cn2_y
>>>
>>>   text_cn3 = "0.03"
>>>
>>>   cn_res3 = True
>>>   cn_res3 at gsMarkerColor = cn_color
>>>   cn_res3 at gsLineColor = cn_color
>>>   cn_res3 at gsMarkerIndex = 4 ; <-- open circle
>>>   cn_res3 at gsMarkerSizeF = cn_res2 at gsMarkerSizeF - offset
>>>   cn_res3 at gsLineThicknessF = 3
>>>   cn_res3 at gsMarkerThicknessF = 3
>>>   cn_res3 at gsFontQuality = "High"
>>>
>>>   cn_res3_text = True
>>>   cn_res3_text at txFontHeightF = cn_res1_text at txFontHeightF
>>>   cn_res3_text at txFontColor   = cn_color
>>>   cn_res3_text at txBackgroundFillColor = "white"
>>>
>>>   gsn_polymarker_ndc(xwks,cn3_x,cn3_y,cn_res3)
>>>   gsn_text_ndc      (xwks,text_cn3,cn3_x + (cn_res3 at gsMarkerSizeF
>>> /2),cn3_y,cn_res3_text)
>>>
>>>   ;------- and lastly, the units text inside the circles...
>>>
>>>   cn4_x = 0.815
>>>   cn4_y = cn3_y
>>>
>>>   text_cn4 = "s~S~-1~N~"
>>>
>>>   cn_res4_text = True
>>>   cn_res4_text at txFontHeightF = cn_res1_text at txFontHeightF
>>>   cn_res4_text at txFontColor   = cn_color
>>>   cn_res4_text at txBackgroundFillColor = -1 ; <-- transparent
>>>
>>>   gsn_text_ndc      (xwks,text_cn4,cn4_x,cn4_y,cn_res4_text)
>>>
>>> *******************
>>>
>>> Please let me know if I can provide any more info to help with this.
>>>
>>> Thanks,
>>> Matt
>>>
>>> [image: Inline image 2]
>>> --
>>> Matthew Flournoy
>>> M.S. Meteorology, University of Oklahoma
>>> B.S. Meteorology, Penn State University
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>
>
> --
> Matthew Flournoy
> M.S. Meteorology, University of Oklahoma
> B.S. Meteorology, Penn State University
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170802/0e7bd95e/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: z.png
Type: image/png
Size: 323171 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170802/0e7bd95e/attachment-0001.png 


More information about the ncl-talk mailing list