Re: adding polymarker to gsn_csm_x2y ...

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu Aug 25 2011 - 09:53:36 MDT

Hi Ufuk,

To add markers, lines, etc, to the second plot, use the special "xy2" attribute that gets returned by plot_csm_x2y. This represents the second plot.

So:

  dum1(i) = gsn_add_polymarker(wks, plot@xy2, varrT(i,:), zraw(i,:),

However, this is going to cause other problems because "xy2" is going to get overriden each time through the loop.

You can work-around this by making sure that the "xy2" attribute is saved before the loop is executed again.

plot2 = new(npoint,graphic)
. . .
 do i = 0, npoint-1
    plot(i) = gsn_csm_x2y(wks, varzT(i,:), varzS(i,:), znew(i,:), resB, resT)
    plot2(i) = plot@xy2
    m_res@gsMarkerColor = "black"
    dum1(i) = gsn_add_polymarker(wks, plot(i), varrT(i,:), zraw(i,:),
m_res)
    m_res@gsMarkerColor = "red"
    dum2(i) = gsn_add_polymarker(wks, plot2(i), varrS(i,:), zraw(i,:),
m_res)
  end do

  resP = True
  resP@gsnPanelFigureStrings = points@name
  resP@gsnPanelFigureStringsFontHeightF = 0.012
  gsn_panel(wks, plot, (/ 1, npoint /),resP)

 
See attached example.

--Mary

  
On Aug 25, 2011, at 9:09 AM, Ufuk Utku Turuncoglu (BE) wrote:

> Hi,
>
> I try to add polymarker to the xy plot that is created by gsn_csm_x2y.
> In this case, each line must have its own polymarkers. The problem is
> the gsn_add_polymarker function uses the bottom axis as a base. So, the
> second polymarker is miss-placed in the plot. Is there any way to
> overcome this problem? Any suggestions can be helpful.
>
> The part of the NCL script is;
>
> m_res = True
> m_res@gsMarkerIndex = 4
> m_res@gsMarkerSizeF = 8.0
>
> do i = 0, npoint-1
> plot(i) = gsn_csm_x2y(wks, varzT(i,:), varzS(i,:), znew(i,:), resB,
> resT)
> m_res@gsMarkerColor = "black"
> dum1(i) = gsn_add_polymarker(wks, plot(i), varrT(i,:), zraw(i,:),
> m_res)
> m_res@gsMarkerColor = "red"
> dum2(i) = gsn_add_polymarker(wks, plot(i), varrS(i,:), zraw(i,:),
> m_res)
> end do
>
> resP = True
> resP@gsnPanelFigureStrings = points@name
> resP@gsnPanelFigureStringsFontHeightF = 0.012
> gsn_panel(wks, plot, (/ 1, npoint /),resP)
>
> Regards,
>
> --ufuk
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Thu Aug 25 09:53:44 2011

This archive was generated by hypermail 2.1.8 : Thu Aug 25 2011 - 09:54:48 MDT