Lineêre grafieke
- Lineêr
- Gradiënt
- Onderskep
Lineêr
Lineêr beteken reguit. 'n Lineêre grafiek is 'n reguit lyn.
Oor die algemeen vertoon 'n lineêre grafiek funksiewaardes.
Voorbeeld
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);
Gradiënt
Die helling is die hoek van die grafiek.
Die helling is die a -waarde in 'n lineêre grafiek:
y = a x
In hierdie voorbeeld, helling = 1.2 :
Voorbeeld
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);
Onderskep
Die snypunt is die beginwaarde van die grafiek.
Die snysnit is die b -waarde in 'n lineêre grafiek:
y = ax + b
In hierdie voorbeeld is helling = 1.2 en snypunt = 2 :
Voorbeeld
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);