New 2D Scatter Plot Program [message #78922] |
Wed, 11 January 2012 11:15 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Folks,
I surprising number of people have been looking on my web page
lately for information on "scatter plots". To that end, I
have created a new 2D scatter plot program, named
cgScatter2D, for producing two-dimensional scatter plots.
You can find the code here:
http://www.idlcoyote.com/programs/cgscatter2d.pro
And you can find the on-line help for the program here:
http://www.idlcoyote.com/idldoc/cg/cgscatter2d.html
This program works very much like cgPlot, with the same
keywords, etc., but in addition it calculates the Pearson
correlation coefficient and fits a straight line though
the data. The correlation coefficient and the fitting
equation are displayed on the plot itself by default.
There are LOTS of keywords, so you can pretty much
decide what you want the final plot to look like.
Here is an example.
data_1 = cgDemoData(1)+ RandomU(seed, 101) * 10
data_2 = cgDemoData(1)+ RandomU(seed, 101) * 10
cgScatter2D, data_1, data_2, SymColor='navy', /Grid
Like all Coyote Graphics routines, you can display this
in a resizeable graphics window:
cgScatter2D, data_1, data_2, SymColor='navy', /Grid, /Window
Or, send the results directly to a PNG or some other
type of raster output:
cgScatter2D, data_1, data_2, SymColor='navy', /Grid, $
Output='scatter.png'
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|