mas wrote:Just add another addplot command:1. How to modify the code above to add a linear regression line, with options for its style (color and thickness)?Code: Select all
\addplot+[no marks,red, thick] {1.2304 * x + 0.5121 } ;
The usual tikz node command should do the trick.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).Code: Select all
\node at (1.5,0) {$Y=1.2304 X + 0.5121} ;
Graphics, Figures & Tables ⇒ pgfplots : How to add a linear regression line?
pgfplots : How to add a linear regression line?
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p