[ncl-talk] explicit legend

Adam Phillips asphilli at ucar.edu
Fri May 15 10:11:38 MDT 2015


Hi Chang,
Yes, this is quite possible, but you will have to create the legend
yourself. Take a look at the NhlNewMarker function:
https://www.ncl.ucar.edu/Document/Functions/Built-in/NhlNewMarker.shtml

You would use that function to create the first marker (the ellipse), and
then draw it 2 more times at different sizes. The 2nd and 3rd markers are
#16 in this table:
http://www.ncl.ucar.edu/Document/Graphics/Images/markers.png
and then the 4th marker is a combination of #4 and #16.

You will likely want to use gsn_polymarker_ndc to draw the polymarkers:
http://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_polymarker_ndc.shtml
Make sure you advance the frame only after all calls to gsn_polymarker_ndc.

Thus, the order would be something like this
1 - create plot, but do not advance the frame
2 - Create new ellipse polymarker with NhlNewMarker
3 - Using gsn_polymarker_ndc draw polymarker created in step #2 three times
in the same spot but with different sizes.
4 - Use gsn_polymarker_ndc to draw red filled and blue filled polymarkers
(marker #16).
5 - Use gsn_polymarker_ndc to draw a red filled circle (#16), then overlay
a thick hollow circle (#4) over the top of it.
6 - Call gsn_text_ndc four times for text.
7 - Advance frame.

Take a look at polymarker example #16 here for a real-world example:
http://www.ncl.ucar.edu/Applications/polyg.shtml#ex16

Hope that helps.. If not or if you have further question, please respond to
the ncl-talk list.
Adam


On Thu, May 14, 2015 at 11:28 AM, Xi Chang <xi.chang01 at gmail.com> wrote:

> Hi NCL users,
>
> I want to put the explicit legend beside my contour plot as attached.
> Is there anyone know how to generate such symbols in the legend ?
>
> Thanks for any hints.
>
> Chang
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>


-- 
Adam Phillips
Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/   303-497-1726

<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150515/5e12f37d/attachment.html 


More information about the ncl-talk mailing list