Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am trying to plot some parametric curves, however I always get an an error saying "Dimension is too large". Is there any way to fix this?

\begin{tikzpicture}[scale=.2]
\draw[very thin,color=gray,step=.5cm,dashed] (-8,-8) grid (4,4);
\draw[<->, blue] (-8,0) -- (4,0) node[below right] {$x$};
\draw[<->, blue] (0,-8) -- (0,4) node[left] {$y$};
\draw [red, thick,  domain=-10:1.1, samples=40] 
 plot ({\x^3-3*\x}, {3*\x^2-9} );
\end{tikzpicture}
share|improve this question
2  
The numbers are too big, just switch to pgfplots and it would work just fine. –  percusse Aug 3 '12 at 14:23
add comment

3 Answers

up vote 8 down vote accepted

enter image description here

\documentclass[11pt]{scrartcl}  
\usepackage{tkz-fct}  

\begin{document}

\begin{tikzpicture}[scale=1.5]
  \tkzInit[xmin=-5,xmax=5,xstep=2,ymin=-10,ymax=4,ystep=2]
  \tkzGrid[sub]
  \tkzAxeX[step=2]
  \tkzAxeY[step=2]
  \tkzFctPar[samples=400,domain=-pi:pi]{t**3-3*t}{3*t**2-9}
\end{tikzpicture}

\end{document} 
share|improve this answer
add comment

With PSTricks just for fun!

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-plot}
\psset{unit=5mm,plotpoints=1000,algebraic}
\begin{document}
\begin{pspicture}(-20,-12)(21,21)
    \psaxes[Dx=5,Dy=5]{->}(0,0)(-20,-12)(20,20)[$x$,0][$y$,90]
    \psparametricplot[linecolor=blue,linewidth=2\pslinewidth]{-3}{3}{t^3-3*t|3*t^2-9}
\end{pspicture}
\end{document}

enter image description here

share|improve this answer
add comment

The problem was with the line

\draw [red, thick,  domain=-10:1.1, samples=40] 
 plot ({\x^3-3*\x}, {3*\x^2-9} );

In particular, your domain=-10:1.1 was too big. You could just change it, or even better, use pgfplots for your task, which is what I've demonstrated below.

Note the use of \pgfplotsset to set global settings in the preamble.

screenshot

\documentclass{article}
\usepackage{pgfplots}

\pgfplotsset{every axis/.append style={
                    axis x line=middle,    % put the x axis in the middle
                    axis y line=middle,    % put the y axis in the middle
                    axis line style={<->,color=blue}, % arrows on the axis
                    xlabel={$x$},          % default put x on x-axis
                    ylabel={$y$},          % default put y on y-axis
            }}

\begin{document}

\begin{tikzpicture}
    \begin{axis}[
            xmin=-8,xmax=4,
            ymin=-8,ymax=4,
            grid=both,
            ]
            \addplot [domain=-3:3,samples=50]({x^3-3*x},{3*x^2-9}); 
    \end{axis}
\end{tikzpicture}
\end{document}
share|improve this answer
    
Thank you, so it seems as it is limited on the size of graphs it can handle. I thought that something was wrong with my code. Thanks again. –  tony Aug 3 '12 at 16:23
add comment

Your Answer

 
discard

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.