沿经度和纬度画一个圆圈

沿经度和纬度画一个圆圈

我有一个圆。我希望沿着它的经纬度对它进行着色,如下所示:沿着纬度,比如从点 A 开始,颜色渐变应该减小直到直径 CD。同样,从点 B(使用与 A 相同的颜色)开始,颜色渐变应该减小直到直径 CD。类似地,我需要沿着圆的经度对圆进行颜色渐变。(从 C 开始到直径 AB,从 D 开始直到直径 AB)。在此处输入图片描述

\documentclass[crop,tikz,border=5mm]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
\begin{document}
\begin{tikzpicture}
\draw (0,0) circle (2cm);
\fill[fill=black] (0,0) circle (1pt);
\node[] at (0.25,0.25) {O};
\node[] at (2.25,0.25) {C};
\node[] at (-2.25,0.25) {D};
\draw[dashed] (-2,0 ) -- (2,0);
\node[] at (0.25,2.25) {A};
\node[] at (0.25,-2.25) {B};
\draw[dashed] (0,2 ) -- (0,-2);
\end{tikzpicture}
\end{document} 

答案1

你不必澄清你的需求,重叠的原因在于两种阴影不可见......

在此处输入图片描述

\documentclass[tikz,border=5mm]{standalone}
\usetikzlibrary{shadings}

\begin{document}
\begin{tikzpicture}
\draw[top color=red, bottom color=white] (2,0) arc (0:180:2);
\draw[top color=white, bottom color=red] (2,0) arc (360:180:2);
\draw[left color=blue, right color=white] (0, 2) arc (90:270:2);
\draw[right color=blue, left color=white] (0,-2) arc (-90:90:2);
\fill[black] (0,0) circle (1pt) node[above right] {O};
\draw[densely dashed]
    ( 90:2) node[above] {A} -- (270:2) node[below] {B}
    (180:2) node[left]  {D} -- (  0:2) node[right] {C};
\end{tikzpicture}

\begin{tikzpicture}
\draw[top color=red, bottom color=white, semitransparent] (2,0) arc (0:180:2);
\draw[top color=white, bottom color=red, semitransparent] (2,0) arc (360:180:2);
\draw[left color=blue, right color=white, semitransparent] (0, 2) arc (90:270:2);
\draw[right color=blue, left color=white, semitransparent] (0,-2) arc (-90:90:2);
\fill[black] (0,0) circle (1pt) node[above right] {O};
\draw[densely dashed]
    ( 90:2) node[above] {A} -- (270:2) node[below] {B}
    (180:2) node[left]  {D} -- (  0:2) node[right] {C};
\end{tikzpicture}
\end{document}

第二张图像有半透明的阴影。

相关内容