Statistical scatter plots
This functionality does not run in MATLAB.
plot::Scatterplot([x_{1}, x_{2}, …]
,[y_{1}, y_{2}, …]
, <a = a_{min} .. a_{max}
>,options
) plot::Scatterplot([[x_{1}, x_{2}, …], [y_{1}, y_{2}, …]]
, <a = a_{min} .. a_{max}
>,options
) plot::Scatterplot([x_{1}, y_{1}], [x_{2}, y_{2}], …
, <a = a_{min} .. a_{max}
>,options
) plot::Scatterplot([[x_{1}, y_{1}], [x_{2}, y_{2}], …]
, <a = a_{min} .. a_{max}
>,options
) plot::Scatterplot(A
, <a = a_{min} .. a_{max}
>,options
) plot::Scatterplot(s
, <c_{1}, c_{2}
>, <a = a_{min} .. a_{max}
>,options
)
plot::Scatterplot
creates a scatter plot
of two discrete data samples [x_{1},
x_{2}, …]
and [y_{1},
y_{2}, …]
. A scatter plot displays
the collection of points with coordinates [x_{1},
y_{1}]
, [x_{2},
y_{2}]
etc.
In addition, a regression line y = a + b x through
the given data pairs [x_{1}, y_{1}]
etc.
is computed and added to the plot. The estimators a, b of
the regression are computed by stats::linReg
.
The regression line can be suppressed by specifying the attribute LinesVisible
= FALSE
.
The samples [x_{1}, x_{2}, …] and [y_{1}, y_{2}, …] should have the same number of elements. Otherwise, superflous elements in the longer list are ignored.
There is an ambiguity between the various input formats if only 2 data points are provided:
Note:
For two data points the calls 
The routines plot::Listplot
and plot::PointList2d
have
a similar functionality. The main additional feature of plot::Scatterplot
is
the regression line.
Scatter plots are useful to visualize the relationship between two variables x (the "predictor") and y (the "criterion").
The variable regarded as a predictor corresponds to the horizontal axis while the variable regarded as the criterion corresponds to the vertical axis. The criterion variable represents the behavior to be predicted. The predictor variable represents the activity which is believed to be associated with the criterion.
The scatter plot consists of points (x, y) where x is a predictor value and y is the corresponding value of the criterion.
If there is a linear relation y = a + b x between x and y, the data points should form a line, potentially marred by statistical deviations. The regression line provided by the scatter plot allows a visual test of such a relation between x and y.
Attribute  Purpose  Default Value 

AffectViewingBox  influence of objects on the ViewingBox of
a scene  TRUE 
AntiAliased  antialiased lines and points?  TRUE 
Data  the (statistical) data to plot  
Frames  the number of frames in an animation  50 
Legend  makes a legend entry  
LegendText  short explanatory text for legend  
LegendEntry  add this object to the legend?  FALSE 
LineColor  color of lines  RGB::Red 
LineWidth  width of lines  0.35 
LineStyle  solid, dashed or dotted lines?  Solid 
LinesVisible  visibility of lines  TRUE 
Name  the name of a plot object (for browser and legend)  
ParameterEnd  end value of the animation parameter  
ParameterName  name of the animation parameter  
ParameterBegin  initial value of the animation parameter  
ParameterRange  range of the animation parameter  
PointSize  the size of points  1.5 
PointColor  the color of points  RGB::Black 
PointStyle  the presentation style of points  FilledCircles 
PointsVisible  visibility of mesh points  TRUE 
TimeEnd  end time of the animation  10.0 
TimeBegin  start time of the animation  0.0 
TimeRange  the real time span of an animation  0.0 .. 10.0 
Title  object title  
TitleFont  font of object titles  [" sansserif " , 11 ] 
TitlePosition  position of object titles  
TitleAlignment  horizontal alignment of titles w.r.t. their coordinates  Center 
TitlePositionX  position of object titles, x component  
TitlePositionY  position of object titles, y component  
Visible  visibility  TRUE 
VisibleAfter  object visible after this time value  
VisibleBefore  object visible until this time value  
VisibleFromTo  object visible during this time range  
VisibleAfterEnd  object visible after its animation time ended?  TRUE 
VisibleBeforeBegin  object visible before its animation time starts?  TRUE 
We plot some data samples:
xdata := [6, 9, 17, 0, 13, 9, 9, 12, 12, 12]: ydata := [7, 8, 20, 2, 11, 8, 9, 12, 13, 15]: b := plot::Scatterplot(xdata, ydata): plot(b)
We can modify the appearance of the scatter plot in various ways:
b::PointColor := RGB::Red: b::PointSize := 3*unit::mm: b::LineColor := RGB::Black: b::LineWidth := 1*unit::mm:
plot(b)
delete xdata, ydata, b:
We analyze the relationship between the time students spent on preparing for a test and the result of the test. We collect the data in a matrix. Each row corresponds to a student. The first column describes the numbers of hours spent for the preparation, the second column contains the corresponding test score (points out of 100):
TimesAndScores := matrix([[ 1, 61], [10, 75], [4, 55], [3, 18], [4, 77], [6, 72], [3, 18], [1, 25], [0, 50], [4, 68], [4, 68], [8, 87], [9, 74], [11, 79], [6, 28], [4, 65], [7, 52], [8, 78], [2, 36], [3, 48], [4, 39] ]):
We draw a scatter plot to identify a possible relationship between the two variables:
plot(plot::Scatterplot(TimesAndScores))
There seems to be a relationship, indeed.
delete TimesAndScores:

The statistical data: numerical real values or arithmetical expressions of
the animation parameter


An array of domain type


A data collection of domain type


Column indices into 

Animation parameter, specified as 