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
Linear means straight. A linear graph is a straight line."
In general, a linear graph display function values.
// Generate values var xValues = []; var yValues = []; for (var x = 0; x <= 10; x += 1) { xValues.push(x); yValues.push(x); } // Display using Plotly var data = [{x:xValues, y:yValues, mode:"lines"}]; var layout = {title: "y = x"}; Plotly.newPlot("myPlot1", data, layout);
var xValues = [];
var yValues = [];
// Generate values
for (var x = 0; x <= 10; x += 1) {
xValues.push(x);
yValues.push(x);
}
// Display using Plotly
var data = [{
x: xValues,
y: yValues,
mode: "lines"
}];
// Define Layout
var layout = {title: "y = x"};
// Display using Plotly
Plotly.newPlot("myPlot", data, layout);
The slope is the angle of the graph.
The slope is the a value in a linear graph:
y = ax
In this example, slope = 1.2:
var slope = 1.2; // Generate values var xValues = []; var yValues = []; for (var x = 0; x <= 10; x += 1) { xValues.push(x); yValues.push(x * slope); } // Display using Plotly var data = [{x:xValues, y:yValues, mode:"lines"}]; var layout = {title: "Slope=" + slope}; Plotly.newPlot("myPlot2", data, layout);
var slope = 1.2;
var xValues = [];
var yValues = [];
// Generate values
for (var x = 0; x <= 10; x += 1) {
xValues.push(x);
yValues.push(x * slope);
}
// Define Data
var data = [{
x: xValues,
y: yValues,
mode: "lines"
}];
// Define Layout
var layout = {title: "Slope=" + slope};
// Display using Plotly
Plotly.newPlot("myPlot", data, layout);
The Intercept is the start value of the graph.
The intercept is the b value in a linear graph:
y = ax + b
In this example, slope = 1.2 and intercept = 2:
var slope = 1.2; var intercept = 7; // Generate values var xValues = []; var yValues = []; for (var x = 0; x <= 10; x += 1) { xValues.push(x); yValues.push(x * slope + intercept); } // Display using Plotly var data = [{x:xValues, y:yValues, mode:"lines"}]; var layout = {title: "Slope=" + slope + " Intercept=" + intercept}; Plotly.newPlot("myPlot", data, layout);
var slope = 1.2;
var intercept = 7;
var xValues = [];
var yValues = [];
// Generate values
for (var x = 0; x <= 10; x += 1) {
xValues.push(x);
yValues.push(x * slope + intercept);
}
// Define Data
var data = [{
x: xValues,
y: yValues,
mode: "lines"
}];
// Define Layout
var layout = {title: "Slope=" + slope + " Intercept=" + intercept};
// Display using Plotly
Plotly.newPlot("myPlot", data, layout);