LaTeX forum ⇒ Graphics, Figures & Tables ⇒ pgfplots : How to add a linear regression line? Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
Masruk
Posts: 1
Joined: Wed May 16, 2018 4:28 pm

pgfplots : How to add a linear regression line?

mas wrote:
1. How to modify the code above to add a linear regression line, with options for its style (color and thickness)?

1. \addplot+[no marks,red, thick] {1.2304 * x + 0.5121 } ;

2. How to show its equation (with many digits)? and to change its "X" and "Y" symbols? (so the equation is using exactly the same symbols as on the axis).

The usual tikz node command should do the trick.
1. \node at (1.5,0) {\$Y=1.2304 X + 0.5121} ;