为什么 pgfplots 曲线出现虚线?

为什么 pgfplots 曲线出现虚线?

曲线为什么会出现虚线?

\documentclass[border=1pt]{standalone}
\usepackage[dvipsnames,svgnames,x11names,]{xcolor}
\usepackage{pgfplots}

\pgfplotsset{compat=1.12}

\begin{document}
    
    \begin{tikzpicture}[line cap=round,line join=round]
        \begin{axis}[view={20}{30},
            xmin=-2, xmax=2,
            ymin=-2, ymax=2,
            zmin=-0, zmax=6.5,
            xtick=\empty,
            ytick=\empty,
            ztick=\empty,
            %enlargelimits=false,   
            ]
                \addplot3+[no markers, variable=t, line width=1pt, DeepPink1 ,domain={-180}:{180},samples=51, samples y=0] ({1*cos((t))}, {1*sin((t))}, {1});
                \addplot3+[no markers, variable=t, line width=1pt, DeepPink1, domain={-180}:{180},samples=51, samples y=0] ({2*cos((t))}, {2*sin((t))}, {.5});  
                \addplot3+[no markers, variable=t, line width=1pt, DeepPink1, domain={-180}:{180},samples=51, samples y=0] ({1*cos((t))/2.05}, {1*sin((t))/2.05}, {2.05});
                \addplot3+[no markers, variable=t, line width=1pt, DeepPink1, domain={-180}:{180},samples=51, samples y=0] ({1*cos((t))/3}, {1*sin((t))/3}, {3});
                \addplot3+[no markers, variable=t, line width=1pt, DeepPink1, domain={-180}:{180},samples=51, samples y=0] ({1*cos((t))/4.2}, {1*sin((t))/4.2}, {4.2}); 
                \addplot3+[no markers, variable=t, DeepPink1 ,domain={-180}:{180},samples=51, samples y=0] ({1*cos((t))}, {1*sin((t))}, {6.5});
                \addplot3+[no markers, variable=t,, domain={-180}:{180},samples=51, samples y=0] ({2*cos((t))}, {2*sin((t))}, {6.5});   
                \addplot3+[no markers, variable=t, DeepPink1, domain={-180}:{180},samples=51, samples y=0] ({1*cos((t))/2.05}, {1*sin((t))/2.05}, {6.5});
                \addplot3+[no markers, variable=t, DeepPink1, domain={-180}:{180},samples=51, samples y=0] ({1*cos((t))/3}, {1*sin((t))/3}, {6.5});
                \addplot3+[no markers, variable=t, DeepPink1, domain={-180}:{180},samples=51, samples y=0] ({1*cos((t))/4.2}, {1*sin((t))/4.2}, {6.5}); 
        \end{axis}
    \end{tikzpicture}   
    
\end{document}

菲古拉

答案1

答案

曲线为何会出现虚线?

因为 pgfplots 循环浏览样式列表,其中一些是虚线。

为了使所有图都坚固,您可以使用every axis plot post/.append style={solid}

\documentclass[border=1pt]{standalone}
\usepackage[dvipsnames,svgnames,x11names,]{xcolor}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}

\begin{document}
    
    \begin{tikzpicture}[line cap=round,line join=round]
        \begin{axis}[view={20}{30},
            xmin=-2, xmax=2,
            ymin=-2, ymax=2,
            zmin=-0, zmax=6.5,
            xtick=\empty,
            ytick=\empty,
            ztick=\empty,
            every axis plot post/.append style={solid}
            %enlargelimits=false,   
            ]
                \addplot3+[no markers, variable=t, line width=1pt, DeepPink1 ,domain={-180}:{180},samples=51, samples y=0] ({1*cos((t))}, {1*sin((t))}, {1});
                \addplot3+[no markers, variable=t, line width=1pt, DeepPink1, domain={-180}:{180},samples=51, samples y=0] ({2*cos((t))}, {2*sin((t))}, {.5});  
                \addplot3+[no markers, variable=t, line width=1pt, DeepPink1, domain={-180}:{180},samples=51, samples y=0] ({1*cos((t))/2.05}, {1*sin((t))/2.05}, {2.05});
                \addplot3+[no markers, variable=t, line width=1pt, DeepPink1, domain={-180}:{180},samples=51, samples y=0] ({1*cos((t))/3}, {1*sin((t))/3}, {3});
                \addplot3+[no markers, variable=t, line width=1pt, DeepPink1, domain={-180}:{180},samples=51, samples y=0] ({1*cos((t))/4.2}, {1*sin((t))/4.2}, {4.2}); 
                \addplot3+[no markers, variable=t, DeepPink1 ,domain={-180}:{180},samples=51, samples y=0] ({1*cos((t))}, {1*sin((t))}, {6.5});
                \addplot3+[no markers, variable=t,, domain={-180}:{180},samples=51, samples y=0] ({2*cos((t))}, {2*sin((t))}, {6.5});   
                \addplot3+[no markers, variable=t, DeepPink1, domain={-180}:{180},samples=51, samples y=0] ({1*cos((t))/2.05}, {1*sin((t))/2.05}, {6.5});
                \addplot3+[no markers, variable=t, DeepPink1, domain={-180}:{180},samples=51, samples y=0] ({1*cos((t))/3}, {1*sin((t))/3}, {6.5});
                \addplot3+[no markers, variable=t, DeepPink1, domain={-180}:{180},samples=51, samples y=0] ({1*cos((t))/4.2}, {1*sin((t))/4.2}, {6.5}); 
        \end{axis}
    \end{tikzpicture}   
    
\end{document}

在此处输入图片描述

相关内容