[ncl-talk] Need help for plotting multiple regression lines in one plot
mireiyue
mireiyue at gmail.com
Wed Mar 2 20:44:49 MST 2016
I won’t forget to add ncltalk email. Attached the 2 figures. And will attached the other two following email..
Thank you
Sun-
> On Mar 2, 2016, at 3:01 PM, Adam Phillips <asphilli at ucar.edu> wrote:
>
> Hi Sun,
> (Please always include the ncl-talk email list on any replies.) As you do have a frame(wks) call at the end of your script, can you set gsnDraw and gsnFrame = True, and send the resulting 4 images to the ncl-talk email list so all can see?
> Thanks,
> Adam
>
> On Wed, Mar 2, 2016 at 2:47 PM, mireiyue <mireiyue at gmail.com <mailto:mireiyue at gmail.com>> wrote:
> Dear NCL users
>
> I am trying to plot three different data with three regression lines in one plot. I can plot all data in one plot but the regression line only plot the first one. How I can plot all three regression lines in one plot? I do appreciate any helps!! Thank you!!
>
> Sun-
>
> rc = regline_stats(calextd,merracmf)
> print(rc)
> pltarry = new((/2,dimsizes(calextd)/),typeof(calextd))
> pltarry(0,:) = merracmf ; use markers
> pltarry(1,:) = rc*(calextd-rc at xave) + rc at yintercept ; use solid line
> printVarSummary(pltarry)
>
> rc1 = regline_stats(camMextd,camMcmf)
> print(rc1)
> pltarry1 = new((/2,dimsizes(camMextd)/),typeof(camMextd))
> pltarry1(0,:) = camMcmf ; use markers
> pltarry1(1,:) = rc*(camMextd-rc at xave) + rc at yintercept ; use solid line
> printVarSummary(pltarry1)
>
> rc2 = regline_stats(camextd,camcmf)
> print(rc2)
> pltarry2 = new((/2,dimsizes(camextd)/),typeof(camextd))
> pltarry2(0,:) = camcmf ; use markers
> pltarry2(1,:) = rc*(camextd-rc at xave) + rc at yintercept ; use solid line
> printVarSummary(pltarry2)
>
> wks = gsn_open_wks("eps","Global")
> res = True ; plot mods desired
> res at gsnDraw = False ; Will draw later, after overlaying
> res at gsnFrame = False ; all plots
> ; res at gsnMaximize = False
> res at trXMinF = 0.
> res at trYMinF = 0.
>
> res at xyMarkLineModes = (/“Markers”,”Lines”/) ; choose which have markers
> res at xyExplicitLegendLabels = “A"
> res at pmLegendParallelPosF = 0.35
> res at xyMarkers = "16" ; choose type of marker
> res at xyMarkerColor = "darkgreen" ; Marker color
> res at xyMarkerSizeF = 0.01 ; Marker size (default 0.01)
> res at xyLineColor = "black"
> res at xyLineThicknesses = 1 ;(/1,2/)
> res at xyDashPatterns = 0 ; solid line
> plot2 = gsn_csm_xy (wks,calextd,pltarry(0:1,:),res)
>
> res at xyMarkers = "7" ; choose type of marker
> res at xyMarkerColor = "blue" ; Marker color
> res at xyMarkerSizeF = 0.01 ; Marker size (default 0.01)
> res at xyExplicitLegendLabels = “B"
> res at pmLegendParallelPosF = 0.79
> res at xyLineColor = "red"
> res at xyLineThicknesses = 1 ;(/1,2/)
> res at xyDashPatterns = 0 ; solid line
> plot1 = gsn_csm_xy (wks,camMextd,pltarry1(0:1,:),res)
>
> res at xyExplicitLegendLabels = “C"
> res at pmLegendParallelPosF = 1.2
> res at xyMarkers = "12" ; choose type of marker
> res at xyMarkerColor = "red" ; Marker color
> res at xyMarkerSizeF = 0.01 ; Marker size (default 0.01)
> res at xyLineColor = "blue"
> res at xyLineThicknesses = 1 ;(/1,2/)
> res at xyDashPatterns = 0 ; solid line
> plot =gsn_csm_xy (wks,camextd,pltarry2(0:1,:),res)
>
> overlay(plot,plot1)
> overlay(plot,plot2)
> draw(plot) ; This will draw all four plots
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>
>
>
>
> --
> Adam Phillips
> Associate Scientist, Climate and Global Dynamics Laboratory, NCAR
> www.cgd.ucar.edu/staff/asphilli/ <http://www.cgd.ucar.edu/staff/asphilli/> 303-497-1726
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160302/5821a490/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Global.pdf
Type: application/pdf
Size: 77873 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160302/5821a490/attachment.pdf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160302/5821a490/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Global1.pdf
Type: application/pdf
Size: 154108 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160302/5821a490/attachment-0001.pdf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160302/5821a490/attachment-0002.html
More information about the ncl-talk
mailing list