<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Tyler,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">You unfortunately can't use xyMarkerColor in this way, where you give it a bunch of markers and then an array of colors to apply to each marker. The XY plotting in NCL wants to apply the same color to a set of markers.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">One way you can do this is to create a blank plot with the correct axes limits, and then use gsn_polymarker. I did this in a hurry because I have a meeting to go to, but see the attached.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">You may also want to visit this page for some more examples (search for "marker"):</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><a href="http://www.ncl.ucar.edu/Applications/polyg.shtml">http://www.ncl.ucar.edu/Applications/polyg.shtml</a><br></div><div class="gmail_default"><br></div><div class="gmail_default">--Mary</div><div class="gmail_default"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 6, 2018 at 4:11 PM, Tyler Herrington <span dir="ltr"><<a href="mailto:therring@uwaterloo.ca" target="_blank">therring@uwaterloo.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Good Afternoon,</div><div><br></div><div>I am looking to create a scatterplot of Change in Tree Fraction vs Change in Grass Fraction where the scatterplot values are colored based on their change in albedo value.</div><div><br></div><div>Each of Tree, Grass and Albedo have been converted into 1D arrays with 6480 values </div><div><br></div><div>Albedo values vary between -0.415 and +0.153, and I am looking to create a colormap with 19 colors from the GMT_polar colormap. </div><div><br></div><div>My script works ok for cases where z = ind() returns a single value (which is the case when i = 0), however it fails if z returns 2 or more values (for example when i=1), and thus I was hoping to put this out to see if anyone had any suggestions on how to fix this problem?</div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div>begin</div></div><div><div><br></div></div><div><div>;*****************************<wbr>***************</div></div><div><div>; Read in Tundra and Boreal Albedo Feedbacks</div></div><div><div>;*****************************<wbr>***************</div></div><div><div><br></div></div><div><div>dirA = "/praid/users/herringtont/<wbr>Caldwell_2016/GFDL_Albedo/<wbr>albedo/"</div></div><div><div>dirV = "/praid/users/herringtont/<wbr>Caldwell_2016/Vegetation_Data/<wbr>"</div></div><div><div><br></div></div><div><div>A1 = dirA+"albedo_Amon_GFDL-ESM2G_<wbr>rcp45_r1i1p1_208001-209912_<wbr>avg_diff_LandOnly_NH.nc"</div></div><div><div>T1 = dirV+"treeFrac_Lmon_GFDL-<wbr>ESM2G_rcp45_r1i1p1_diff_Frac_<wbr>LandOnly_NH.nc"</div></div><div><div>G1 = dirV+"grassFrac_Lmon_GFDL-<wbr>ESM2G_rcp45_r1i1p1_diff_Frac_<wbr>LandOnly_NH.nc"</div></div><div><div><br></div></div><div><div>A2 = addfile(A1,"r")</div></div><div><div>T2 = addfile(T1,"r")</div></div><div><div>G2 = addfile(G1,"r")</div></div><div><div><br></div></div><div><div>ALB = A2 ->rsuscs(4,:,:)</div></div><div><div>Grass = G2 ->grassFrac(4,:,:)</div></div><div><div>Tree = T2 ->treeFrac(4,:,:)</div></div><div><div><br></div></div><div><div>;*****************************<wbr>***************</div></div><div><div>; Reshape ALB, Tree, and Grass from 2D to 1D </div></div><div><div>;*****************************<wbr>***************</div></div><div><div><br></div></div><div><div>ALB1d = ndtooned(ALB)</div></div><div><div>Tree1d = ndtooned(Tree)</div></div><div><div>Grass1d = ndtooned(Grass)</div></div><div><div><br></div></div><div><div>;*****************************<wbr>*******</div></div><div><div>; Create Color Scale for Scatterplot</div></div><div><div>;*****************************<wbr>*******</div></div><div><div><br></div></div><div><div>dALB = dimsizes(ALB1d)</div></div><div><div>colorALB = new(dALB,"integer")</div></div><div><div>clrs = (/2,3,4,5,6,7,8,9,10,12,13,14/<wbr>)</div></div><div><div><br></div></div><div><div>i = 0</div></div><div><div>do while (i.le.10)</div></div><div><div><br></div></div><div><div>j = i-1</div></div><div><div><br></div></div><div><div>if (i.eq.0) then</div></div><div><div> </div></div><div><div> VAL1 = -0.45</div></div><div><div> VAL2 = -0.40</div></div><div><div><br></div></div><div><div>else </div></div><div><div> VAL1 = -0.35+(0.05*j)</div></div><div><div> VAL2 = -0.30+(0.05*j)</div></div><div><div>end if</div></div><div><div><br></div></div><div><div>print(VAL1)</div></div><div><div>print(VAL2)</div></div><div><div><br></div></div><div><div>z = ind(ALB1d.gt.VAL1.and.ALB1d.<wbr>lt.VAL2)</div></div><div><div><br></div></div><div><div>print(z)</div></div><div><div>print(i)</div></div><div><div><br></div></div><div><div>colorALB(z) = clrs(i)</div></div><div><div><br></div></div><div><div>i = i+1</div></div><div><div><br></div></div><div><div>end do</div></div><div><div><br></div></div><div><div>print(colorALB)</div></div><div><div>;*****************************<wbr>*************************</div></div><div><div>; Create April Mean Veg vs Alb Change Scatterplot</div></div><div><div>;*****************************<wbr>*************************</div></div><div><div><br></div></div><div><div>wks = gsn_open_wks("png","GFDL_Veg_<wbr>Alb_Apr_Scatter_Color") </div></div><div><div><br></div></div><div><div>gsn_define_colormap(wks,"GMT_<wbr>polar")</div></div><div><div><br></div></div><div><div>res = True</div></div><div><div>res@gsnDraw = False ; Don't draw plot or advance</div></div><div><div>res@gsnFrame = False ; frame. Will do this later.</div></div><div><div><br></div></div><div><div>res@tiXAxisString = "Change in Tree Fraction"</div></div><div><div>res@tiYAxisString = "Change in Grass Fraction"</div></div><div><div><br></div></div><div><div><br></div></div><div><div>square = NhlNewMarker(wks, "y", 35, 0.0, 0.0, 1., 0.5, 0.)</div></div><div><div> res@xyMarkLineMode = "Markers"</div></div><div><div> res@xyMarkerThicknessF = 2.5</div></div><div><div> res@xyMarkerColor = colorALB </div></div><div><div> res@xyMarker = square ; this is a filled square</div></div><div><div><br></div></div><div><div><br></div></div><div><div>plot = gsn_csm_xy(wks,Tree1d,Grass1d,<wbr>res)</div></div><div><div><br></div></div><div><div> maximize_output(wks,False)</div></div><div><div><br></div></div><div><div>system("mv *.png /home/herringtont/Caldwell_<wbr>2016/figures/scatterplot")</div></div><div><div><br></div></div><div><div><br></div></div><div><div>end</div></div></blockquote><div><br></div><div><br></div><div>here is the printout from the script when I execute it currently:</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div>Variable: VAL1</div></div><div><div>Type: float</div></div><div><div>Total Size: 4 bytes</div></div><div><div> 1 values</div></div><div><div>Number of Dimensions: 1</div></div><div><div>Dimensions and sizes: [1]</div></div><div><div>Coordinates:</div></div><div><div>(0) -0.45</div></div><div><div><br></div></div><div><div><br></div></div><div><div>Variable: VAL2</div></div><div><div>Type: float</div></div><div><div>Total Size: 4 bytes</div></div><div><div> 1 values</div></div><div><div>Number of Dimensions: 1</div></div><div><div>Dimensions and sizes: [1]</div></div><div><div>Coordinates:</div></div><div><div>(0) -0.4</div></div><div><div><br></div></div><div><div><br></div></div><div><div>Variable: z</div></div><div><div>Type: integer</div></div><div><div>Total Size: 4 bytes</div></div><div><div> 1 values</div></div><div><div>Number of Dimensions: 1</div></div><div><div>Dimensions and sizes: [1]</div></div><div><div>Coordinates:</div></div><div><div>(0) 3265</div></div><div><div><br></div></div><div><div><br></div></div><div><div>Variable: i</div></div><div><div>Type: integer</div></div><div><div>Total Size: 4 bytes</div></div><div><div> 1 values</div></div><div><div>Number of Dimensions: 1</div></div><div><div>Dimensions and sizes: [1]</div></div><div><div>Coordinates:</div></div><div><div>(0) 0</div></div><div><div><br></div></div><div><div><br></div></div><div><div>Variable: VAL1</div></div><div><div>Type: float</div></div><div><div>Total Size: 4 bytes</div></div><div><div> 1 values</div></div><div><div>Number of Dimensions: 1</div></div><div><div>Dimensions and sizes: [1]</div></div><div><div>Coordinates:</div></div><div><div>(0) -0.35</div></div><div><div><br></div></div><div><div><br></div></div><div><div>Variable: VAL2</div></div><div><div>Type: float</div></div><div><div>Total Size: 4 bytes</div></div><div><div> 1 values</div></div><div><div>Number of Dimensions: 1</div></div><div><div>Dimensions and sizes: [1]</div></div><div><div>Coordinates:</div></div><div><div>(0) -0.3</div></div><div><div>fatal:Number of dimensions on right hand side do not match number of dimension in left hand side</div></div><div><div>fatal:["Execute.c":8640]:<wbr>Execute: Error occurred at or near line 61 in file Albedo_Veg_GFDL_Scatter.ncl</div></div></blockquote><div><br></div><div><br></div>Thank you for your help,<div><br></div><div>Sincerely,<br><div><br clear="all"><div><div dir="ltr" class="m_-6445154337426401235gmail_signature"><div class="m_-6445154337426401235gmail_signature"><div dir="ltr"><div><div dir="ltr">Tyler Herrington, MSc<div>PhD Student (Climate Science)</div><div>Geography and Environmental Management</div><div>University of Waterloo</div><div><img src="https://docs.google.com/uc?export=download&id=0B3tOGC9C-gd6Mzl6TzBCSDlJdk0&revid=0B3tOGC9C-gd6K2RNL0V1Z3hUa0pOZE5oV1dmdEovUDNENEEwPQ"><br></div></div></div></div></div></div></div></div></div></div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>