[ncl-talk] circular polymarker woes

Matt Flournoy mflournoy37 at gmail.com
Mon Jul 31 09:56:02 MDT 2017


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170731/0ad55fb5/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/20170731/0ad55fb5/attachment-0001.png 


More information about the ncl-talk mailing list