<div dir="ltr">Hi Karin,<div>Thanks for your detail explanation and a nice script. This worked fine for me but I thought there would have been a simpler way to do that. </div><div>Thanks for your time.</div><div><br></div><div>Best,</div><div>SB</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jul 20, 2019 at 5:12 PM Karin Meier-Fleischer <<a href="mailto:meier-fleischer@dkrz.de">meier-fleischer@dkrz.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF">
    Ok. I would recommend to create a blank plot and add the markers to
    the plot. The polymarker resources have to be changed from
    xyMarker... to  gsMarker..!<br>
    <br>
    Here is an example which draws each data point as a triangle in a
    different color.<br>
    <br>
    <font color="#3333ff"><tt>begin</tt><tt><br>
      </tt><tt><br>
      </tt><tt>  x = (/0.205, 0.280, 0.211, 0.229, 0.283, 2.141,
        2.160/)  ;-- your x-data</tt><tt><br>
      </tt><tt>  y = (/0.155, 0.050, 0.151, 0.159, 0.053, 0.151,
        0.150/)  ;-- your y-data</tt><tt><br>
      </tt><tt><br>
      </tt><tt>  colors =
        (/"red","green","blue","black","orange","magenta","brown"/) ;--
        color array</tt><tt><br>
      </tt><tt>  </tt><tt><br>
      </tt><tt>  wks = gsn_open_wks("x11","plot_markers") ;-- graphics
        output type</tt><tt><br>
      </tt><tt><br>
      </tt><tt>  res                     = True</tt><tt><br>
      </tt><tt>  res@gsnDraw             = False           ;-- don't
        draw the plot, yet</tt><tt><br>
      </tt><tt>  res@gsnFrame            = False           ;-- don't
        advance frame, yet</tt><tt><br>
      </tt><tt>  </tt><tt><br>
      </tt><tt>  res@trXMinF             = 0.0             ;-- x-axis
        minimum</tt></font><font color="#3333ff"><tt><br>
      </tt><tt>  res@trXMaxF             = 2.3</tt></font><font color="#3333ff"><tt><font color="#3333ff"><tt>             ;--
            x-axis maximum</tt></font></tt><tt><br>
      </tt><tt>  res@trYMinF             = 0.04</tt></font><font color="#3333ff"><tt><font color="#3333ff"><tt>            ;--
            y-axis minimum</tt></font></tt><tt><br>
      </tt><tt>  res@trYMaxF             = 0.18</tt></font><font color="#3333ff"><tt><font color="#3333ff"><tt>            ;--
            y-axis maximum</tt></font></tt><tt><br>
      </tt><tt>  </tt><tt><br>
      </tt><tt>  plot = gsn_csm_blank_plot (wks, res)      ;-- create a
        blank plot</tt><tt><br>
      </tt><tt><br>
      </tt><tt>  mres                    = True</tt><tt><br>
      </tt><tt>  mres@gsMarkerIndex      = 10              ;-- choose
        marker types</tt><tt><br>
      </tt><tt>  mres@gsMarkerSizeF      = 0.02            ;-- choose
        marker size</tt><tt><br>
      </tt><tt>  mres@gsMarkerThicknessF = 3.0             ;-- choose
        marker thickness</tt><tt><br>
      </tt><tt>  </tt><tt><br>
      </tt><tt>  do i=0,dimsizes(x)-1</tt><tt><br>
      </tt><tt>     mres@gsMarkerColor   = colors(i)       ;-- set
        marker colors</tt><tt><br>
      </tt><tt>     id = unique_string("mark")             ;-- create
        unique id</tt><tt><br>
      </tt><tt>     plot@$id$ =
        gsn_add_polymarker(wks,plot,x(i),y(i),mres) ;-- add marker to
        plot</tt><tt><br>
      </tt><tt>  end do</tt><tt><br>
      </tt><tt>  </tt><tt><br>
      </tt><tt>  draw(plot)    ;-- draw the plot</tt><tt><br>
      </tt><tt>  frame(wks)    ;-- advance the frame</tt><tt><br>
      </tt><tt><br>
      </tt><tt>end</tt></font><br>
    <br>
    -Karin<br>
    <br>
    <br>
    <div class="gmail-m_2307709259089621675moz-cite-prefix">Am 20.07.19 um 09:08 schrieb S Br:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">Hi Karin,
        <div>I have tried this simple script but still it doesn't work.
          I can't produce the markers with different colors.</div>
        <div><br>
        </div>
        <div>Thanks.</div>
        <div>SB</div>
        <div><br>
        </div>
        <div>begin<br>
          <br>
            x = (/0.205, 0.280/)<br>
            y = (/0.155, 0.050/)<br>
          <br>
            wks = gsn_open_wks("X11","Test_fig")             ; send
          graphics to PNG file<br>
          <br>
            res                     = True<br>
            res@gsnDraw             = False            ; don't draw<br>
            res@gsnFrame            = False            ; don't advance
          frame<br>
          <br>
            res@xyMarkLineModes  = (/"Markers","Markers"/)   ;-- set
          mark line mode for both variables<br>
            res@xyMarkers        = (/ 10, 16/)               ;-- choose
          marker types<br>
            res@xyMarkerColors   = (/"red","blue"/)          ;-- choose
          marker colors<br>
          <br>
            plot                    = gsn_csm_xy (wks,x,y,res)<br>
          <br>
          draw(plot)<br>
          frame(wks)<br>
          end<br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Fri, Jul 19, 2019 at 4:00
          PM Karin Meier-Fleischer via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div bgcolor="#FFFFFF"> Hi SB,<br>
            <br>
            to use two different markers with different colors set the
            resources of xyMarkLineModes and xyMarkers like below.<br>
            <br>
            <font color="#3333ff"><tt>  res@xyMarkLineModes  = <b>(/"Markers","Markers"/)</b>  
                ;-- set mark line mode for both variables</tt><tt><br>
              </tt><tt>  res@xyMarker<b>s</b>        = (/ 10,
                16/)               ;-- choose marker types </tt><tt><br>
              </tt><tt>  res@xyMarkerColors   =
                (/"red","blue"/)          ;-- choose marker colors</tt></font><br>
            <br>
            -Karin<br>
            <br>
            <div class="gmail-m_2307709259089621675gmail-m_-2665531694252477999moz-cite-prefix">Am
              19.07.19 um 16:41 schrieb S Br via ncl-talk:<br>
            </div>
            <blockquote type="cite">
              <div dir="ltr">Hi All,
                <div>Is it possible to draw markers with different color
                  in a XY plot. I am trying as given below but doesn't
                  work.</div>
                <div><br>
                </div>
                <div>Thanks.</div>
                <div>SB</div>
                <div><br>
                </div>
                <div>x = (/0.205, 0.280, 0.211, 0.229, 0.283, 2.141,
                  2.160/)<br>
                  <div>y = (/0.155, 0.050, 0.151, 0.159, 0.053, 0.151,
                    0.150/)<br>
                  </div>
                </div>
                <div><br>
                </div>
                <div> res@xyMarkLineModes     = "Markers"<br>
                     res@xyMarker            = 9<br>
                     res@xyMarkerSizeF       = 0.02                    
                     ; default 0.01<br>
                     res@xyMarkerThicknessF  = 2.0                      
                    ; default 1.00<br>
                     res@xyMarkerColors         =  (/ "green4", "red",
                  "blue", "orange", \<br>
                                                     "cyan2",
                  "darkorchid2", "brown"/)<br>
                  <br>
                     plot                    = gsn_csm_xy (wks,x,y,res)<br>
                  <br>
                  draw(plot)<br>
                  frame(wks)<br>
                  end<br>
                </div>
              </div>
              <br>
              <fieldset class="gmail-m_2307709259089621675gmail-m_-2665531694252477999mimeAttachmentHeader"></fieldset>
              <pre class="gmail-m_2307709259089621675gmail-m_-2665531694252477999moz-quote-pre">_______________________________________________
ncl-talk mailing list
<a class="gmail-m_2307709259089621675gmail-m_-2665531694252477999moz-txt-link-abbreviated" href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>
List instructions, subscriber options, unsubscribe:
<a class="gmail-m_2307709259089621675gmail-m_-2665531694252477999moz-txt-link-freetext" href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></pre>
            </blockquote>
            <br>
          </div>
          _______________________________________________<br>
          ncl-talk mailing list<br>
          <a href="mailto:ncl-talk@ucar.edu" target="_blank">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/mailman/listinfo/ncl-talk</a></blockquote>
      </div>
    </blockquote>
    <br>
  </div>

</blockquote></div>