[gradsusr] [non-nasa source] [EXTERNAL] Add regression line to scatter plot

Saunders, Emily (GSFC-610.1)[SCIENCE SYSTEMS AND APPLICATIONS INC] emily.saunders at nasa.gov
Wed Oct 30 16:12:04 EDT 2019


Hi Jennifer,

I want to know how to add a best fit line and equation (including the slope value) to a scatter plot in GrADs. I have attached an example that should explain what I want to do.

Thanks,

Emily

From: gradsusr <gradsusr-bounces at gradsusr.org> On Behalf Of Adams, Jennifer M. (GSFC-610.2)[ADNET SYSTEMS INC]
Sent: Tuesday, October 08, 2019 2:32 PM
To: GrADS Users Forum <gradsusr at gradsusr.org>
Subject: Re: [gradsusr] [non-nasa source] [EXTERNAL] Add regression line to scatter plot

Hi, Emily –
What exactly is your question?

--
Jennifer Miletta Adams
ADNET Systems, Inc.
NASA/GSFC, Code 610.2
Building 32, Room S159
(301) 614-6070


From: gradsusr <gradsusr-bounces at gradsusr.org<mailto:gradsusr-bounces at gradsusr.org>> on behalf of "Saunders, Emily (GSFC-610.1)[SCIENCE SYSTEMS AND APPLICATIONS INC]" <emily.saunders at nasa.gov<mailto:emily.saunders at nasa.gov>>
Reply-To: GrADS Users Forum <gradsusr at gradsusr.org<mailto:gradsusr at gradsusr.org>>
Date: Tuesday, October 1, 2019 at 9:59 AM
To: "gradsusr at gradsusr.org<mailto:gradsusr at gradsusr.org>" <gradsusr at gradsusr.org<mailto:gradsusr at gradsusr.org>>
Subject: [non-nasa source] [EXTERNAL] [gradsusr] Add regression line to scatter plot

Hello all,

I have a question about adding a linear regression line to a scatter plot using the ‘sregr’ command. Here is a sample of the script I created:

'set lat 54 60'
'set lon -120 -110'
*'define a=o3*1e9'
'define a = ave(o3*1.0e9, time='d_start''timestring', time='d_end''timestring')'
say 'define a = ave(o3*1.0e9, time='d_start''timestring', time='d_end''timestring')'
'set vrange 0 60'
*'define b=pm25_rh35_gcc'
'define b = ave(pm25_rh35_gcc, time='d_start''timestring', time='d_end''timestring')'
say 'define b = ave(pm25_rh35_gcc, time='d_start''timestring', time='d_end''timestring')'
'set vrange 0 1200'
'set gxout scatter'
'set cmark 2'
'set cthick 12'
'set ccolor 9'
    titlepm25gcc = 'Surface_O3_and_PM25_Scatter_plot'
    diagnostic = 'Surface'
    location = 'Alberta'
    type = 'Scatter'
    imagenamepm25gcc = diagnostic'.'location'.NRT.'fieldnamepm25gcc'.scatter_plot.('d_start':'d_end').'MM'.'DD'.'YYYY'.png'
'd b;a'
*'set time 'timestring
*'set lat 54 60'
*'set lon -120 -110'
*'set gxout line'
*'set z 1'
*'set t 1'
*'set cmark 0'
*'set cthick 12'
*'set ccolor 0'
*'set cstyle 0'
*'set line 1 1 5'
*'d sregr(b, a, lon=-120, lon=-110, lat=54, lat=60)'

Thanks for your help in advanced.

Emily Saunders, PhD.
Senior Research Scientist
Global Modeling and Assimilation Office/SSAI
NASA Goddard Space Flight Center Bldg 33, Room B-227B
Code 610.1, Greenbelt, MD, 20771
Phone: +1-301-614-6532

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gradsusr.org/pipermail/gradsusr/attachments/20191030/41fc5952/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Scatter plot example.xlsx
Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Size: 13360 bytes
Desc: Scatter plot example.xlsx
URL: <http://gradsusr.org/pipermail/gradsusr/attachments/20191030/41fc5952/attachment-0001.xlsx>


More information about the gradsusr mailing list