[ncl-talk] How to plot regression coefficient

Dennis Shea shea at ucar.edu
Mon Sep 15 22:38:47 MDT 2014


http://www.ncl.ucar.edu/Applications/regress.shtml
===========
rc=regCoef(x,y(lat|:,lon|:,time|:))

;dimensions
rc!0="lat"
rc!1="lon"
;coordinates
rc&lat=lat
rc&lon=lon

************************************************
; plotting parameters: Example 2
;************************************************
   wks  = gsn_open_wks("ps" ,"regress")
   gsn_define_colormap(wks,"ViBlGrWhYeOrRe")    ; choose colormap

   res                       = True
   res at gsnMaximize           = True             ; make large

   res at cnFillOn              = True             ; turn on color
   res at cnLinesOn             = False            ; turn off contour lines
   res at cnLineLabelsOn        = False            ; turn off contour line labels
   res at cnFillMode            = "RasterFill"

   res at cnLevelSelectionMode  = "ManualLevels"   ; set manual contour levels
   res at cnMinLevelValF        =  -1.00           ; set min contour level
   res at cnMaxLevelValF        =   1.00           ; set max contour level
   res at cnLevelSpacingF       =   0.10           ; set contour interval

   res at mpFillOn              = False            ; turn off default
background gray
   res at mpCenterLonF          = 210

  ;res at tiMainString          = fili
   plot = gsn_csm_contour_map_ce(wks,rc,res)



On Mon, Sep 15, 2014 at 12:00 PM, Rainer Luptowitz <rlupt001 at ucr.edu> wrote:

> Hi,
>
> How do you plot a regression coefficient line on an x,y plot and spatial
> map?
> If you have
>
> x=time (years)
> y=precipitation rate (mm/s).
>
> rc=regCoef(x,y(lat|:,lon|:,time|:))
>
> ;dimensions
> rc!0="lat"
> rc!1="lon"
> ;rc!time="time"
> ;coordinates
> rc&lat=lat
> rc&lon=lon
> ;rc&time=time
>
> printVarSummary(rc)
> print("rc MinMax")
> printMinMax(rc,0)
>
> I tried to create
>
> y=mx+b
>
> but the right hand side couldn't be coerced to the left hand side. So I'm
> not sure if this is the way to set up the plot parameters for
>
> plot=gsn_csm_xy(wks,x,y,res)
>
> If someone could explain how to go about plotting an 'xy plot' and
> 'spatial contour map' of the regression coefficient it would be most
> helpful.
>
> Thank you,
>
> Rainer Luptowitz
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140915/8c3cdac2/attachment.html 


More information about the ncl-talk mailing list