[ncl-talk] Creating a Scatter Plot With...

Barry Lynn barry.h.lynn at gmail.com
Thu Sep 5 13:02:53 MDT 2019


Hi Adam:

Thank you.

Just to reiterate your point.  When I added:

res at xyMarkerSizeF = mark_sizes ; an array I created.

I increased the size of the second index in the xaxis and yaxis array to 3
from 2, since I added a third resource.

Barry

On Thu, Sep 5, 2019 at 9:37 PM Adam Phillips <asphilli at ucar.edu> wrote:

> Hi Barry,
> Thanks for providing a simple easy to use script that illustrates the
> issue. Even though you are not creating a scatter plot, to get different
> marker colors and styles you do need your x and y inputs to be two
> dimensional as that is how the xyMarkerColors/xyMarkers resources apply
> their settings.
>
> As an example, if you have three markers to draw and you want each to be a
> different color and a different symbol, the hypothetical coding would look
> like this:
> xaxis = new((/3,2/),float)    ; need two dimensional array for different
> marker colors/styles, and the second dimension must be of size =>2
> yaxis = xaxis
>
> ; fill in xaxis/yaxis arrays for (:,0), no need to fill in data for (:,1)
> in this specific example
>
> res = True
> ...
> res at xyMarkerColors     =  (/"green","blue","red"/)
> res at xyMarkers            = (/ 3,4,5/)
> plot  = gsn_csm_xy (wks,xaxis,yaxis,res)
>
> The above coding will result in:
> xaxis(0,0) / yaxis(0,0) value being shaded green with marker style #3
> xaxis(1,0) / yaxis(1,0) value being shaded blue with marker style #4
> xaxis(2,0) / yaxis(2,0) value being shaded red with marker style #5
>
> I've attached a modified version of your script with the resulting output.
> Adam
>
> On Thu, Sep 5, 2019 at 10:07 AM Barry Lynn via ncl-talk <ncl-talk at ucar.edu>
> wrote:
>
>> Hello:
>>
>> I have a relatively simple program to create a scatter plot (attached).
>>
>> There are actually three sets of numbers, which are put into the xaxis
>> and yaxis.
>>
>> I also set:
>>
>>   res at xyMarkerColors     =  colors
>>
>>   res at xyMarkers          :=  markers
>>
>>
>> with the hope to create three sets of marker with different colors and
>> marker symbol.
>>
>>
>> However, all my markers are blue and the same symbol (the first setting).
>>
>>
>> I am wondering how to set specific marker and colors for each element of
>> the xaxis, yaxis, 1 dimensional arrays.
>>
>>
>> I saw something in the NCL pages about creating a two dimensional array,
>> but this was for a scatter plot, which mine technically is not.
>>
>>
>> https://www.ncl.ucar.edu/Applications/Scripts/scatter_1.ncl
>>
>>
>> Thank you,
>>
>>
>> --
>> Barry H. Lynn, Ph.D
>> Senior Associate Scientist, Lecturer,
>> The Institute of the Earth Science,
>> The Hebrew University of Jerusalem,
>> Givat Ram, Jerusalem 91904, Israel
>> Tel: 972 547 231 170
>> Fax: (972)-25662581
>>
>> C.E.O, Weather It Is, LTD
>> Weather and Climate Focus
>> http://weather-it-is.com
>> Jerusalem, Israel
>> Local: 02 930 9525
>> Cell: 054 7 231 170
>> Int-IS: x972 2 930 9525
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> 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>
>


-- 
Barry H. Lynn, Ph.D
Senior Associate Scientist, Lecturer,
The Institute of the Earth Science,
The Hebrew University of Jerusalem,
Givat Ram, Jerusalem 91904, Israel
Tel: 972 547 231 170
Fax: (972)-25662581

C.E.O, Weather It Is, LTD
Weather and Climate Focus
http://weather-it-is.com
Jerusalem, Israel
Local: 02 930 9525
Cell: 054 7 231 170
Int-IS: x972 2 930 9525
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190905/003c50f6/attachment.html>


More information about the ncl-talk mailing list