TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am discovering PSTricks's plotstyle=LSM to make a regression analysis y=m x + c. Here is my code:

0.0     0.0
144.321  0.84
159.407     0.8925




\psaxes[axesstyle=frame,Dx=50,Dy=0.5, ticksize=0 4pt](150,3)
\listplot [xStart=0, xEnd=150,xunit=1,plotstyle=values,rot=90] {\data}
\listplot [xStart=0,xEnd=150,xunit=1,linewidth=1.5pt,linecolor=red,showpoints, dotstyle=square] {\data}
\listplot[PstDebug=1,xStart=0, xEnd=150,xunit=1,plotstyle=LSM,linecolor=blue, linestyle=dashed]{\data}


The parameter xEnd=150 makes the Linear regression analysis only to consider the first two lines of the data file.

On compiling I get the line equation as

y = 0.291017 x + 9.64966e-08

I see that the gradient of 0.291017 seems to be wrong as the gradient should be 0.84/144.321 = 0.0058...

What am I doing wrong here?

share|improve this question
up vote 5 down vote accepted

that was a problem with different axes unit. Try it with this version:


With this file it works for me.

And by the way, there is now a pst-fit, see http://texnik.dante.de/doc/generic/pst-fit/pst-fit-doc.pdf

share|improve this answer
Thanks. It is now working properly. 1 Vote up. – yCalleecharan Nov 29 '11 at 8:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.