图形的轴标记和居中

图形的轴标记和居中

代码1:

\documentclass[12pt]{article}
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{decorations.markings}

\usepackage[margin=1in]{geometry}

\begin{document}
    \begin{figure}[h!]
        \centering
        \begin{tikzpicture}
            \begin{axis}[view={110}{20},
                height = 4in,width=4in,
                axis lines=center,axis on top,
                no marks,axis equal,
                xlabel = $x$,
                xmin=-2.5,xmax=2.5,ymin=-2.5,ymax=2.5,zmin=-2.5,zmax=2.5,
                        enlargelimits={upper=0.1}]
                \addplot3+[color = blue, thick, no markers,samples=250, samples y=0,domain=0:2*pi,variable=\t, decoration={
    markings,
    mark=between positions 0.01 and .999 step 2em with {\arrow [scale=1]{stealth}}
    }, postaction=decorate]({sin(\t r)},{sin(2*\t r)},{sin(3*\t r)});
                \addplot3+[color = red, thick,samples = 2, domain = 0:1, variable = \t, -stealth] ({sin(3 r) + \t*cos(3 r)}, {sin(6 r) + 2*cos(6 r)*\t}, {sin(9 r) + 3*cos(9 r)*\t});
            \end{axis}
        \end{tikzpicture}
    \end{figure}
\end{document}

输出 1: 在此处输入图片描述

代码2:

\documentclass[12pt]{article}
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{decorations.markings}

\usepackage[margin=1in]{geometry}

\begin{document}
    \begin{figure}[h!]
        \centering
        \begin{tikzpicture}
            \begin{axis}[view={110}{20},
                height = 9in,width=9in,
                axis lines=center,axis on top,
                no marks,axis equal,
                xmin=-2.5,xmax=2.5,ymin=-2.5,ymax=2.5,zmin=-2.5,zmax=2.5,
                        enlargelimits={upper=0.1}]
                \addplot3+[color = blue, thick, no markers,samples=250, samples y=0,domain=0:2*pi,variable=\t, decoration={
    markings,
    mark=between positions 0.01 and .999 step 2em with {\arrow [scale=1]{stealth}}
    }, postaction=decorate]({sin(\t r)},{sin(2*\t r)},{sin(3*\t r)});
                \addplot3+[color = red, thick,samples = 2, domain = 0:1, variable = \t, -stealth] ({sin(3 r) + \t*cos(3 r)}, {sin(6 r) + 2*cos(6 r)*\t}, {sin(9 r) + 3*cos(9 r)*\t});
            \end{axis}
        \end{tikzpicture}
    \end{figure}
\end{document}

输出 2: 在此处输入图片描述

对于代码 1,为什么 x 标签不在正确位置?如何让标签在 x 轴以及 y 和 z 轴上的正确位置正确?对于代码 2,当我设置高度 = 宽度 = 9 英寸时,图形不再居中。如何使其居中?

相关内容