HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
Collecting data is the most important part of any Machine Intelligence projects."
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 |
A Scatter Plot has points scattered over an area representing the relationship between two values.
var xArray = [50,60,70,80,90,100,110,120,130,140,150];
var yArray = [7,8,8,9,9,9,10,11,14,14,15];
// Define Data
var data = [{
x: xArray,
y: yArray,
mode:"markers"
}];
// Define Layout
var layout = {
xaxis: {range: [40, 160], title: "Square Meters"},
yaxis: {range: [5, 16], title: "Price in Millions"},
title: "House Prices vs. Size"
};
// Display with Plotly
Plotly.newPlot("myPlot", data, layout);
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 |
var xArray = [50,60,70,80,90,100,110,120,130,140,150];
var yArray = [7,8,8,9,9,9,10,11,14,14,15];
// Define Data
var data = [{
x: xArray,
y:yArray,
mode:"lines"
}];
// Define Layout
var layout = {
xaxis: {range: [40, 160], title: "Square Meters"},
yaxis: {range: [5, 16], title: "Price in Millions"},
title: "House Prices vs Size"
};
// Display with Plotly
Plotly.newPlot("myPlot", data, layout);
Scatter plots are great for:
var xArray = [50,60,70,80,90,100,110,120,130,140,150]; var yArray = [7,8,8,9,9,9,10,11,14,14,15]; var xValues = []; var yValues = []; var layout = { xaxis: {range: [40, 160],title: "Square Meters"}, yaxis: {range: [5, 16],title: "Price in Millions"}, title:"House Prices vs. Size" }; plotXYArrays("myPlot21","scatter",xArray,yArray,layout); plotXYArrays("myPlot22","lines",xArray,yArray, layout); function plotXYArrays(id, type, xArray, yArray, layout) { let mode = "lines"; let graph = "scatter"; if (type == "scatter") {mode = "markers"}; if (type == "bars") {graph = "bar"}; Plotly.newPlot(id, [{x:xArray, y:yArray, mode:mode, type:graph}], layout); }