Home > Sample Charts > ScatterPlot

ScatterPlot

The Scatter plot is most often used to answer questions like “How does Age affect Reaction time?” where you have a variety of measurements and are trying to get an impression of the relationships between them. Of course a relationship does not always imply causality, but with care it is usually possible to make a predictive model which gives useful information.

SharpPlot offers two very different ways to show the relationship between the variables. You can use the ‘TrendLine’ style which simply creates a smooth curve, which roughly tracks the data, but has no mathematical significance. By varying the flexibility of the curve, you can adjust the result to suit the data you are working with. Alternatively you can use the ‘ModelFit’ style to fit a regression equation to the data (typically a linear model but polynomial curves up to quartic are supported) which may be appropriate if you are sure there is some underlying mechanism behind the observed values.


SharpPlot sp = new SharpPlot;
sp.SetMargins(9,18,18,4);
sp.ScatterPlotStyle = ScatterPlotStyles.ModelFit|ScatterPlotStyles.Risers;
sp.SetMarkers(Marker.Lozenge);
sp.SetLineStyles(LineStyle.Dash);
ydata = new int[] {190,270,310,120,190,230};
xdata = new int[] {17,31,29,14,16,24};
sp.DrawScatterPlot(ydata,xdata);

Worked Examples

scatterplot1 scatterplot2 scatterplot3 scatterplot4

Send comments on this topic
© Dyalog Ltd 2013