Scatter Plots

 
  • Data Collections
  • Scatter Plots
  • Graphs

 

Data Collection

 

Collecting data is the most important part of any Machine Intelligence projects.

The most common data to collect are numbers and measurements.

Often data are stored in arrays representing the relationship between values.

This table contains house prices versus size:

Price 7 8 8 9 9 9 10 11 14 14 15
Size 50 60 70 80 90 100 110 120 130 140 150

Scatter Plots

A Scatter Plot has points scattered over an area representing the relationship between two values.

Example

<!DOCTYPE html>
<html>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<body>

<div id="myPlot" style="width:100%;max-width:700px"></div>

<script>
const xArray = [50,60,70,80,90,100,110,120,130,140,150];
const yArray = [7,8,8,9,9,9,10,11,14,14,15];

// Define Data
const data = [{
  x:xArray,
  y:yArray,
  mode:"markers"
}];

// Define Layout
const layout = {
  xaxis: {range: [40, 160], title: "Square Meters"},
  yaxis: {range: [5, 16], title: "Price in Millions"},  
  title: "House Prices vs. Size"
};

// Display using Plotly
Plotly.newPlot("myPlot", data, layout);
</script>

</body>
</html>



Graphs

A Graph can also be used to show the same values:

Price 7 8 8 9 9 9 10 11 14 14 15
Size 50 60 70 80 90 100 110 120 130 140 150
 

Source Code

<!DOCTYPE html>
<html>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<body>

<div id="myPlot" style="width:100%;max-width:700px"></div>

<script>
const xArray = [50,60,70,80,90,100,110,120,130,140,150];
const yArray = [7,8,8,9,9,9,10,11,14,14,15];

// Define Data
const data = [{
  x: xArray,
  y: yArray,
  mode:"lines"
}];

// Define Layout
const layout = {
  xaxis: {range: [40, 160], title: "Square Meters"},
  yaxis: {range: [5, 16], title: "Price in Millions"},  
  title: "House Prices vs. Size"
};

// Display using Plotly
Plotly.newPlot("myPlot", data, layout);
</script>

</body>
</html>

 


When to Use Scatter Plots

Scatter plots are great for:

  • Seeing the "Big Picture"
  • Compare different values
  • Discovering potential trends
  • Discovering patterns in data
  • Discovering relationships between data
  • Discovering Clusters and Correlations

 

 
ML Scatter Plots

Login
ADS CODE