Lineare Diagramme
- Linear
- Neigung
- Abfangen
Linear
Linear bedeutet gerade. Ein linearer Graph ist eine gerade Linie.
Im Allgemeinen zeigt ein lineares Diagramm Funktionswerte an.
Beispiel
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);
Neigung
Die Steigung ist der Winkel des Graphen.
Die Steigung ist der a -Wert in einem linearen Diagramm:
y = ein x
In diesem Beispiel Steigung = 1,2 :
Beispiel
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);
Abfangen
Der Schnittpunkt ist der Startwert des Diagramms.
Der Schnittpunkt ist der b- Wert in einem linearen Diagramm:
y = ax + b
In diesem Beispiel ist Steigung = 1,2 und Achsenabschnitt = 2 :
Beispiel
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);