Hi i have two plot with two linear regression but the legend show the same equation for the straight line... i have not made a MWE because I thought that does not serve. Is needed?
\pgfplotstableread{
X Y
97 1.0
96 15
96 29.2
96 32
98 42.4
98 59.2
98 66.1
97 84.4
100 94.0
}\tableA
\pgfplotstablecreatecol[linear regression]
{regression}
{\tableA}
\xdef\slopeA{\pgfplotstableregressiona} %<-- might be handy occasionally
\xdef\interceptA{\pgfplotstableregressionb}
\pgfplotstableread{
X Y
0.05 0.17
0.05 0.041
0.05 0.023
0.1 0.332
0.1 0.089
0.1 0.041
0.15 0.5
0.15 0.132
0.15 0.06
}\tableB
\pgfplotstablecreatecol[linear regression]
{regression}
{\tableB}
\xdef\slopeB{\pgfplotstableregressiona} %<-- might be handy occasionally
\xdef\interceptB{\pgfplotstableregressionb}
and in every plot i put this for make a the legend...
\addlegendentry{%
$\pgfmathprintnumber{\pgfplotstableregressiona} \cdot x
\pgfmathprintnumber[print sign]{\pgfplotstableregressionb}$}
This one of my plot...
\addplot [%
point meta=explicit,
scatter,
scatter/use mapped color={draw=mapped color,fill=mapped color},
mark=*,
draw=none, forget plot]table[meta=X] {\tableA};
\addplot [mesh,mesh line legend,point meta=x,domain=95.2:99.8,very thick,samples=1000] {\slopeA*x+\interceptA};

\slopeAand\slopeBin your legend: That's why you used the\xdefassignment, so you'd be able to refer to the parameters later on. – Jake Jun 21 '12 at 21:01