[gradsusr] Scatter plot

Ally Toure allytoure at gmail.com
Thu Dec 15 15:18:15 EST 2016


Hi Jeff,
I managed to make the script work thanks again for your help

I got the script below
at ftp://cola.gmu.edu/grads/scripts/box_and_whisker.gs

when I try to run it I am getting the error message:
Syntax Error:  Invalid Operand
  'ts' not a variable or function name

and not sure what I am missing.
Thanks
Ally




* Demonstrates how to use gxout bar and errbar to draw a box and whisker
plot

'open model.ctl'

* pick a variable and an area, in this case surface temperature in central
US
var = 'ts'
minlat='30'
maxlat='50'
minlon='-110'
maxlon='-80'
tlast=5

* define variables: mean, plus 1 stddev, minus 1 stddev, min, max,
'set x 1'
'set y 1'
'set t 1 'tlast
'define mean =
tloop(aave('var',lon='minlon',lon='maxlon',lat='minlat',lat='maxlat'))'
'define pstd = mean +
tloop(aave(sqrt(pow('var'-mean,2)),lon='minlon',lon='maxlon',lat='minlat',lat='maxlat'))'
'define mstd = mean -
tloop(aave(sqrt(pow('var'-mean,2)),lon='minlon',lon='maxlon',lat='minlat',lat='maxlat'))'
'define vmax =
tloop(max(max('var',lon='minlon',lon='maxlon'),lat='minlat',lat='maxlat'))'
'define vmin =
tloop(min(min('var',lon='minlon',lon='maxlon'),lat='minlat',lat='maxlat'))'

* set up the plot
'clear'
'set vrange 260 300'
'set t 0.5 'tlast+0.5

* draw bars centered on the mean, spanning the range from plus/minus 1
standard deviaton
'set gxout bar'
'set bargap 50'
'set baropts outline'
'd mstd;pstd'

* draw error bars spanning the range from the min/max values
'set gxout errbar'
'd vmin;vmax'

* draw yellow line showing the mean values
'set gxout line'
'set cmark 0'
'set cthick 6'
'd mean'




On Thu, Dec 15, 2016 at 2:40 PM, Ally Toure <allytoure at gmail.com> wrote:

> Jeff,
> Thanks so much. I appreciate your help.
> Ally
>
> On Thu, Dec 15, 2016 at 2:02 PM, Jeff Duda <jeffduda319 at gmail.com> wrote:
>
>> Ally,
>>
>> The example you link to is a script that makes a scatter plot. You don't
>> need a script to make a scatter plot, although the scatter.gs script
>> probably makes a nicer looking plot than the simple way, detailed as
>> follows:
>>
>> Without a script, you can make a scatter plot as simply as entering
>>
>> set gxout scatter
>> d field1;field2
>>
>> where field1 and field2 are arrays in your data file (you can see a list
>> of arrays by typing "q file" at the command prompt or by looking in your
>> control file). There are numerous other commands you can use to adjust the
>> look of the resulting plot, including set vrange/vrange2 to adjust the
>> x-/y-axis limits, digsize to control the size of the markers, and perhaps
>> cmark to control the type of mark plotted.
>>
>> Regarding the link, you have to download the script code on that website.
>> Then, once grads is running, you need to type "run" before the script name
>> and arguments. Also, make sure to include the full pathname of the script
>> code unless you have set the environmental variable GASCRP to the location
>> of your script code. Then you don't have to include the full path.
>>
>> Good luck.
>>
>> Jeff Duda
>>
>> On Thu, Dec 15, 2016 at 12:52 PM, Ally Toure <allytoure at gmail.com> wrote:
>>
>>> Hi All,
>>> I am a new grads user. I am trying to make a scatter plot.
>>> I found an example
>>> here
>>> http://gradsaddict.blogspot.com/2013/07/script-scattergs-eas
>>> ily-create-scatter.html
>>> when I try to run the following commands
>>> *xarray='1 2 3 4 5 6 7 8 9 10' *
>>> *yarray='1 2 3 4 5 6 7 8 9 10' *
>>>
>>>
>>>
>>> *'scatter -x 'xarray' -y 'yarray *
>>> *I *was getting the following error message:
>>>
>>> Unknown command: scatter
>>>
>>> Could someone tell me what I am missing.
>>>
>>> Thanks
>>> Ally
>>>
>>> _______________________________________________
>>> gradsusr mailing list
>>> gradsusr at gradsusr.org
>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>
>>>
>>
>>
>> --
>> Jeff Duda
>> Post-doctoral research fellow
>> University of Oklahoma School of Meteorology
>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20161215/6a0ed521/attachment-0001.html 


More information about the gradsusr mailing list