Graphics, Figures & TablesPSTricks error, why?

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
timppapoika
Posts: 10
Joined: Mon Mar 30, 2009 9:59 am

PSTricks error, why?

Post by timppapoika »

I'm starting to lose my mind here! Although LaTeX is very versatile, it sometimes can be be a pain in the ass! Now I'm trying to plot graph using the Least Square Method with pstricks-add and I've encountered a weird problem. I took the code from an example, but LaTex says:

Code: Select all

!Missing number treated as zero.
<to be read again>
                \def
l.283 \listplot
                [plotstyle=dots]{\data}
? h
A number should have been here; I inserted '0'.
Here's the code:

Code: Select all

\psset{lly=-.5cm} 
\readdata{\data}{LSM.data} 
\begin{psgraph}[arrows=->](0,0)(0,0)(8,8){.5\textwidth} 
\listplot[plotstyle=dots]{\data}
\listplot[plotstyle=LSM,linecolor=red]{\data}
\end{psgraph} 
I've set the data in the premble.

Can somebody help? My report is due wednesday, and the graphs are the only things left.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

PSTricks error, why?

Post by localghost »

timppapoika wrote:[...] Although LaTeX is very versatile, it sometimes can be be a pain in the ass! [...]
Please take care of your language and choose more appropriate words next time.

Attach the file LSM.data to your next post to make the problem comprehensible.


Best regards and welcome to the board
Thorsten¹
timppapoika
Posts: 10
Joined: Mon Mar 30, 2009 9:59 am

PSTricks error, why?

Post by timppapoika »

Is "butt" more appropriate?

Anyways, the LMS.data looks like this:

Code: Select all

\begin{filecontents*}{LSM.data} 
0 1 1 3 2.8 4 3 2.9 2 5 4 4 5 5.5 6 8.2 8 7 
\end{filecontents*} 
As I said I took the code from an example, which can be found on page 112 in http://www.ctan.org/tex-archive/graphic ... dd-doc.pdf
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

PSTricks error, why?

Post by localghost »

Your code misses the second mandatory argument for vertical size to the psgraph environment as described in the example from the pstricks-add manual.

Code: Select all

\begin{filecontents*}{LSM.data}
  0 1 1 3 2.8 4 3 2.9 2 5 4 4 5 5.5 6 8.2 8 7
\end{filecontents*}
\psset{lly=-.5cm}
\readdata{\data}{LSM.data}
\begin{psgraph}[arrows=->](0,0)(0,0)(8,8){.5\textwidth}{!}
  \listplot[plotstyle=dots]{\data}
  \listplot[plotstyle=LSM,linecolor=red]{\data}
\end{psgraph}
timppapoika
Posts: 10
Joined: Mon Mar 30, 2009 9:59 am

PSTricks error, why?

Post by timppapoika »

Thanks for the reply, localghost!

Adding the second argument for lenght of the y-axis results in a different error:

Code: Select all

!Undefined control sequence.
<recently read> \c@lor@to@ps

l.284 ...rrows=->}(0,0)(0,0)(8,8){.5\textwidth}{!}
I tried substituting the last two arguments to {10cm} and {5cm}, but the same error popped up.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

PSTricks error, why?

Post by localghost »

Take a look at item #5 in the list of frequently done errors on the homepage of PSTricks.
timppapoika
Posts: 10
Joined: Mon Mar 30, 2009 9:59 am

Re: PSTricks error, why?

Post by timppapoika »

Thanks a billion, localghost! It worked! You can't imagine how reliefed and thankful I am. Thanks again, you eased my life significantly!
Post Reply