Home > Sample Charts > ScatterPlot > A Simple Scatter of 2 Variables

A Simple Scatter of 2 Variables

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.

The first step is simply to plot the price against most likely cause (floor area) as a simple xy plot, There is a relationship here, but there is also a lot of apparently random noise which should be investigated further.


SharpPlot sp = new SharpPlot;

area = new int[] {1326,782,312,1460,1056,752,1120,904,1654,735,565,346,698,775,696,
         741,432,517,747,914,603,1292,551,1383,1580,754,850,518,634};
price = new int[] {60500,47500,46000,110000,148000,65000,79950,54000,120000,85000,
         65000,55000,70000,82500,78500,49950,46950,46950,77000,102000,37500,68000,
         65000,145000,98000,75000,96500,53950,75000};

sp.Heading = "Does Area Affect Price?";
sp.YAxisStyle = YAxisStyles.AtEndCaption;
sp.YCaption = "Price\n(£Thou)";
sp.YFactor = 1000;
sp.XCaption = "Floor Area (sq ft)";

sp.DrawScatterPlot(price,area);

Worked Examples

scatterplot1 scatterplot2 scatterplot3 scatterplot4

Send comments on this topic
© Dyalog Ltd 2013