<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>
<div>Hi Rick,</div>

<div>thanks a lot for your help. I try your suggestion. Now I get an markerColors array, but in the plot all markers still have the same color (black). I think the plot1 is overwritten each time.&nbsp; Do you have an idea how can I reach that every marker is drawn individuel and gets a different color?</div>

<div>&nbsp;</div>

<div>I have attached my script, my plot and my data.</div>

<div>&nbsp;</div>

<div>Thanks for your help.</div>

<div>&nbsp;</div>

<div>Anna
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"><b>Gesendet:</b>&nbsp;Dienstag, 14. Juli 2015 um 17:23 Uhr<br/>
<b>Von:</b>&nbsp;&quot;Rick Brownrigg&quot; &lt;brownrig@ucar.edu&gt;<br/>
<b>An:</b>&nbsp;&quot;Hartmut Bittner&quot; &lt;anna@hbittnersth.de&gt;<br/>
<b>Cc:</b>&nbsp;&quot;ncl-talk@ucar.edu&quot; &lt;ncl-talk@ucar.edu&gt;<br/>
<b>Betreff:</b>&nbsp;Re: [ncl-talk] xy-plot with markers (depending on a 3. variable)</div>

<div name="quoted-content">
<div>
<div>Hi Anna,<br/>
<br/>
&nbsp;</div>

<div>You have this as your loop code:<br/>
<br/>
&nbsp;&nbsp; do&nbsp; i= 1, num_distinct_markers<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; res@xyMarkerColors = 2 + i* col_step* t(i)<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;print(2+i*col_step)<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; plot1&nbsp; = gsn_csm_xy (wks,x_1,y_1,res)<br/>
&nbsp;&nbsp; end do&nbsp;<br/>
&nbsp;&nbsp; draw(plot1)<br/>
&nbsp;&nbsp; frame(wks)<br/>
&nbsp;</div>

<div>I&#39;m surprised this doesn&#39;t report errors, but it is generating &quot;num_distinct_markers&quot;&nbsp; unique *plots*, with all the markers of the i-th plot colored with the i-th color, and plot1 is overwritten each time, with the last plot prevailing.&nbsp;<br/>
<br/>
What I was suggesting was to create an array of colors &quot;num_distinct_markers&quot; long, and populate that with your marker colors, as in :<br/>
&nbsp;</div>

<div>&nbsp;&nbsp; markerColors = new((/ num_distinct_markers /), integer)</div>

<div>&nbsp;&nbsp; do i=0, num_distinct_markers - 1</div>

<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; markerColors(i) = 2 + i*col_step * t(i)</div>

<div>&nbsp;&nbsp; end do<br/>
&nbsp;</div>

<div>&nbsp;&nbsp; res@xyMarkerColors = markerColors</div>

<div>&nbsp;&nbsp; plot1 = gsn_csm_xy(wks, x_1, y_1, res)<br/>
&nbsp;</div>

<div>&nbsp;&nbsp; draw(plot1)</div>

<div>&nbsp;&nbsp; frame(wks)<br/>
&nbsp;</div>

<div>This is untested, without having your data.&nbsp; Also note that in your example, you&#39;re indexing over 1..num_distinct_markers, whereas I&#39;m looping from 0..(num_distinct_markers - 1).&nbsp;&nbsp; I&#39;m not totally sure which is correct for your case.<br/>
&nbsp;</div>

<div>Hope that helps...</div>

<div>Rick</div>

<div><br/>
&nbsp;</div>

<div>&nbsp;</div>
</div>

<div class="gmail_extra">&nbsp;
<div class="gmail_quote">On Tue, Jul 14, 2015 at 6:31 AM, Hartmut Bittner <span>&lt;<a href="anna@hbittnersth.de" target="_parent">anna@hbittnersth.de</a>&gt;</span> wrote:

<blockquote class="gmail_quote" style="margin: 0 0 0 0.8ex;border-left: 1.0px rgb(204,204,204) solid;padding-left: 1.0ex;">
<div>
<div style="font-family: Verdana;font-size: 12.0px;">
<div>
<div>Hi,</div>

<div>
<div>I try to realize Ricks idea. But my problem is still that all my markers have the same color.</div>

<div>&nbsp;</div>

<div><em>My problem in generel is: I have 1 data set that consists of a x- position ( in my&nbsp; script: x), a y-position ( in my script: y) and a 3. value (for example the temperature, in my script: t). I want to creat&nbsp; an x-y plot with the x/y-position and the marker should be controlled by the 3. variable t.&nbsp; So that I have an 2D-Plot in which 3 variables are presented.</em></div>

<div><em>For exemple the color of the marker gets red for higher t-values and gets green for lower t-values.</em></div>

<div>&nbsp;</div>

<div>I made an loop over the &quot;xyMarkersColors&quot;,but all makers have the same color. I want that the makers have different colors. I think for reaching this goal in every do loop only 1 markers has to be drawn. So that after n- loops all the n xyMarkers are drawn.&nbsp; How can I reach this? And how can I realize the dependent of the markersColors of variable t? If I put t into the do loop I get an segmentation fault.</div>

<div>&nbsp;</div>

<div>&nbsp;</div>

<div>Thanks for your help</div>

<div>&nbsp;</div>

<div>Anna Lena</div>

<div style="margin: 10.0px 5.0px 5.0px 10.0px;padding: 10.0px 0 10.0px 10.0px;border-left: 2.0px solid rgb(195,217,229);">
<div style="margin: 0 0 10.0px 0;"><b>Gesendet:</b>&nbsp;Donnerstag, 09. Juli 2015 um 19:26 Uhr<br/>
<b>Von:</b>&nbsp;&quot;Rick Brownrigg&quot; &lt;<a href="brownrig@ucar.edu" target="_parent">brownrig@ucar.edu</a>&gt;<br/>
<b>An:</b>&nbsp;&quot;Anna Lena Bittner&quot; &lt;<a href="anna@hbittnersth.de" target="_parent">anna@hbittnersth.de</a>&gt;<br/>
<b>Cc:</b>&nbsp;&quot;<a href="ncl-talk@ucar.edu" target="_parent">ncl-talk@ucar.edu</a>&quot; &lt;<a href="ncl-talk@ucar.edu" target="_parent">ncl-talk@ucar.edu</a>&gt;<br/>
<b>Betreff:</b>&nbsp;Re: [ncl-talk] xy-plot with markers (depending on a 3. variable)</div>

<div>
<div class="h5">
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>Hi Anna,<br/>
&nbsp;</div>
One approach is exemplified by example #8 at:<br/>
<br/>
<a href="http://ncl.ucar.edu/Applications/polyg.shtml" target="_blank">http://ncl.ucar.edu/Applications/polyg.shtml</a><br/>
&nbsp;</div>
This approach draws the markers 1-by-1, looping over the marker array and setting the colors for each one based upon some criterion.<br/>
&nbsp;</div>
Another approach, more or less the same amount of effort, is to set up an array for the resource &quot;xyMarkerColors&quot; that contains a color value for each marker to be drawn. You&#39;d need an array the same length as your xy data, and would have to loop over it to fill in each entry with a color value based on your 3rd variable.<br/>
&nbsp;</div>
I note that you are already setting the resource xyMarkerColors with 2 colors. According to the documentation, if you have more xy data than color-values in xyMarkerColors, the remaining markers are drawn with the color set by the resource xyMarkerColor (singular) -- the default for that resource is whatever the foreground color (typically black).&nbsp; So what you should have gotten in your existing example is one green marker, one blue marker, and the remainder black (?)&nbsp;<br/>
&nbsp;</div>
Make sense?<br/>
&nbsp;</div>
Rick</div>

<div class="gmail_extra">&nbsp;
<div class="gmail_quote">On Thu, Jul 9, 2015 at 10:25 AM, Anna Lena Bittner <span>&lt;<a>anna@hbittnersth.de</a>&gt;</span> wrote:

<blockquote class="gmail_quote" style="margin: 0 0 0 0.8ex;border-left: 1.0px rgb(204,204,204) solid;padding-left: 1.0ex;">Hi,<br/>
<br/>
I would like to create a xy-plot with markers. The markers should have different colors. The colors should be controlled by a 3. variable.<br/>
In my plot I already created the makers, but I don&#39;t know how to define the color with a 3. variable ( in my case the variable t).<br/>
I couldn&#39;t find a description for this kind of plot. If there is a description on the homepage let me know.<br/>
<br/>
I have attached my scripts here.<br/>
<br/>
<br/>
Thanks a lot for your help.<br/>
<br/>
<span><font color="#888888">Anna Lena</font></span><br/>
<br/>
_______________________________________________<br/>
ncl-talk mailing list<br/>
<a>ncl-talk@ucar.edu</a><br/>
List instructions, subscriber options, unsubscribe:<br/>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br/>
&nbsp;</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br/>
_______________________________________________<br/>
ncl-talk mailing list<br/>
<a href="ncl-talk@ucar.edu" target="_parent">ncl-talk@ucar.edu</a><br/>
List instructions, subscriber options, unsubscribe:<br/>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br/>
&nbsp;</blockquote>
</div>
</div>
</div>
</div>
</div>
</div></div></body></html>