[ncl-talk] xy-plot marker color + style

Kreienkamp Frank Frank.Kreienkamp at dwd.de
Thu Nov 23 07:18:38 MST 2017


Hallo,

i am trying to plot a xy-plot. With each marker having a different color and marker style:

; ***********************************************
; xy_4.ncl
;
; Concepts illustrated:
;   - Drawing a scatter plot
;   - Changing the markers in an XY plot
;   - Changing the marker color in an XY plot
;   - Changing the marker size in an XY plot
;   - Creating your own markers for an XY plot
;
; ***********************************************
;
; These files are loaded by default in NCL V6.2.0 and newer
; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
;************************************************
begin
;************************************************
data                           = new((/2,5/),float)
data at _FillValue                = -999.
data(:,0)                      = (/      4.80,     -4.26 /)
data(:,1)                      = (/      4.97,     14.63 /)
data(:,2)                      = (/      4.55,    -22.12 /)
data(:,3)                      = (/      4.47,     -4.51 /)
data(:,4)                      = (/      3.11,     19.09 /)

colors = (/"white","black","blue","green" ,"cyan", "darkorange","chocolate4" /)
Marker = new(5,integer)
Marker = (/16,14,11,7,3 /)
print(colors)
print(Marker)
;************************************************
; plotting parameters
;************************************************
wks   = gsn_open_wks ("png","xy-test")                ; send graphics to PNG file
gsn_define_colormap(wks,colors)
res                   = True                     ; plot mods desired
res at tiMainString      = "Scatter Plot"           ; add title
res at xyMarkLineModes   = "Markers"                ; choose which have markers
res at xyMarkers         =  Marker                      ; choose type of marker
 res at xyMarkerColors    = colors (2:)              ; Marker color
res at xyMarkerSizeF     = 0.01                     ; Marker size (default 0.01)
res at tmLabelAutoStride = True                     ; nice tick mark labels
plot  = gsn_csm_xy (wks,data(0,:),data(1,:),res) ; create plot

end

Unfortunately all markers have the same color and style. What am i doing wrong?

Thanks in advance
Frank




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171123/9d249cad/attachment.html>


More information about the ncl-talk mailing list