선형 그래프

  • 선의
  • 경사
  • 가로채다

선의

선형 은 직선을 의미합니다. 선형 그래프는 직선입니다.

일반적으로 선형 그래프는 함수 값을 표시합니다.

예시

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);

경사

기울기 는 그래프의 각도입니다 .

기울기는 선형 그래프 의 값입니다.

y = 엑스

이 예에서 기울기 = 1.2 :

예시

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);

가로채다

절편 은 그래프의 시작 값입니다 .

절편은 선형 그래프의 b 값입니다.

y = 도끼 + b

이 예에서 기울기 = 1.2 및 절편 = 2 :

예시

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);