如何使球体上的网格线具有不同的颜色

如何使球体上的网格线具有不同的颜色

下面是绘制球体的简单代码。我想用红色表示高度线,用蓝色表示子午线。抱歉,我在手册中找不到相关信息。你能帮我吗?

\documentclass[tikz]{standalone}
 \usepackage{pgfplots}
 \pgfplotsset{compat=1.8}
 \begin{document}
\begin{tikzpicture}
        \begin{axis}[%
        axis equal, %colormap/RdGy-11, %colormap/viridis, 
        width=10cm,
        height=10cm,
        axis lines = center,
        xlabel = {$x$},
        ylabel = {$y$},
        zlabel = {$z$},
        ticks=none,
        enlargelimits=0.3,
        view/h=135,
        scale uniformly strategy=units only,
        smooth,
        ]
        \addplot3[%
        opacity = 0.5, %shader=faceted interp, 
        surf, fill=white, %color=blue, 
        z buffer = sort, 
        samples = 21,
        variable = \u,
        variable y = \v,
        domain = 0:180,
        y domain = 0:360,
        ]
        ({cos(u)*sin(v)}, {sin(u)*sin(v)}, {cos(v)});
    \end{axis}
\end{tikzpicture}
\end{document}

相关内容