[ncl-talk] probability over xy plot

Mary Haley haley at ucar.edu
Thu Oct 22 12:25:40 MDT 2015


Sun,

In the future, please respond back to ncl-talk and not just the person that
answered the question.  We need to keep the correspondence on ncl-talk so
that other people can see the final answer.

The page sent you to has many examples, and not just for
gsn_add_polymarker. Did you scroll down and look at the different examples?


In order to add markers to an existing plot, you need to use the same data
space as your plot, otherwise NCL has no idea where the markers are
supposed to go. Your data space is defined by "massvsext" on the X axis,
and "probt&lat" on the Y axis, but you were trying to put markers at
"massvsext" on the X axis and at "probt" on the Y axis. This won't work,
because your Y axis is represented by latitude.

I think what you want to do is find all the index locations where probt >
95, and then use these index locations to subscript massvsext and probt&lat:

Also, you were then trying to overlay the markers on the plot using
"overlay". This is not necessary. The gsn_add_polymarker is what adds the
markers to the plot.

Here's what I think your code should look like (this is untested, because I
don't have your dataset):

   gsres               = True
   gsres at gsMarkerIndex = 16      ;use filled circles
           gsres at gsMarkerSizeF = 10
   gsres at gsMarkerColor = "Blue"

;---Get indexes where probt > 95
   ii = ind(probt.gt.95)

;---Add markers at these index locations
   mkid = gsn_add_polymarker(wks,plot,massvsext(ii),probt&lat(ii),gsres)

   draw(plot)     ; Drawing "plot" will draw the added markers

   frame(wks)


On Wed, Oct 21, 2015 at 7:18 AM, mireiyue <mireiyue at gmail.com> wrote:

> I am sorry I forgot to attach…
> the symbols don’t show up on the plot. I want to put symbols on the point
> where has 95% confidence level. I tried to follow the link that you sent
> but it only use gun_add_polymaker. Attached script and figure.
>
> Thank you for your time and help
> Sun-
>
>
>
>
>
>
> On Oct 21, 2015, at 12:57 AM, Mary Haley <haley at ucar.edu> wrote:
>
> Sun,
>
> There was no attached figure.
>
> It would help if you explain what you mean by "they are not working".  Do
> you mean the markers are not showing up?
> When you use gsn_add_polymarker, this only attaches the markers to the
> plot and it doesn't draw them at that point. You then have to draw the plot
> in order to see both the markers and the plot.
>
> gsn_polymarker_ndc is usually for putting markers *outside* of your plot,
> for example, to define a legend.  This procedure requires that you use unit
> values (from 0.0 to 1.0) to specify the location of your markers.
>
> Please see our examples page for more details:
>
> http://www.ncl.ucar.edu/Applications/polyg.shtml
>
> If you continue to have problems, please include the image and a script if
> possible.
>
> Thanks,
>
> --Mary
>
>
> On Tue, Oct 20, 2015 at 8:35 AM, mireiyue <mireiyue at gmail.com> wrote:
>
>> Dear NCL users
>>
>> Do you know how I can plot probability on xy plot? X axis is correlation
>> values and Y axis is latitude (attached figure).
>> I tried “gsn_add_polymarker” and “gsn_polymarker_ndc” but they are not
>> working.
>>
>> I do appreciate any helps.
>>
>> Thank you
>> Sun-
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151022/46be3172/attachment.html 


More information about the ncl-talk mailing list