0

I'm trying to create a 3-D parametric curve using TikZ. I also want to add decoration arrows along the curve. However, I'm getting an error message saying the dimension is too large. So is there any way to get rid of the error message? Below is the code:

\documentclass{standalone}
\usepackage{amssymb, amsmath, amsthm}
\usepackage{mathrsfs, mathtools, commath}

\usepackage{tikz, pgfplots}
\pgfplotsset{compat=1.15}
\definecolor{CPgreen}{RGB}{21, 71, 52}
\definecolor{CPgold}{RGB}{198, 146, 20}
\definecolor{Sealgray}{RGB}{84, 88, 90}
\definecolor{Skyblue}{RGB}{181, 227, 216}
\usetikzlibrary{arrows}
\usetikzlibrary{decorations.markings}

\usepackage{tikz-3dplot}
\tdplotsetmaincoords{70}{110}
\begin{document}
\begin{center}
    \begin{tikzpicture}[tdplot_main_coords,
        line cap =round,>=latex,line width=0.5pt,font=\scriptsize]
        
        \node (O) at (0,0,0) {};
        \draw[->] (O.center) -- (4,0,0) node[anchor=north east]{$x$};
        \draw[->] (O.center) -- (0,3.75,0) node[anchor=west]{$y$};
        \draw[->] (O.center) -- (0,0,3.75) node[anchor=south]{$z$};

        \begin{scope}[decoration={
                markings,
                mark=at position 0.15 with {\arrow{>}},
                mark=at position 0.5 with {\arrow{>}},
                mark=at position 0.85 with {\arrow{>}}}]
            \draw[postaction={decorate},line width = 0.825,color=CPgold] plot [variable=\t, domain=0:2*pi, samples=100, smooth] 
            ({2*cos(deg(\t))},{1.5*sin(deg(\t))},{\t-1});
        \end{scope}
    
    \end{tikzpicture}
\end{center}
\end{document}

The decoration arrows work if I use PGF instead, but PGF's axis does not align with mine.

Here is the Overleaf link: https://www.overleaf.com/4452138147qnvxcwtxmgbn

Thanks for the help.

3
  • Welcome to TeX.SE. There is no error if you remove the smooth option (see for instance this question; pre length and post length don't seem to help here, however).
    – frougon
    Jul 17 at 12:40
  • It never occurred to me to change that; thank you! Jul 17 at 13:50
  • You're welcome. I was surprised the first time I saw this too! :)
    – frougon
    Jul 17 at 15:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.