4

I have a plot on a set of curved axes.

I want shading from the center of the axis circles fading to white on the outer axis. Using center=red puts the center of the shading in the center of the shaded area, not the center of the diagram, and I can't combine top color=red, left color=red, right color=white, bottom color=white.

How can I achieve this using TikZ? My current MWE is below. enter image description here

\documentclass[class=minimal,border=0pt]{standalone}
\usepackage{textcomp}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}

\shade [top color=red] (0,0) -- (6:5) arc (6:-140:5) -- (0,0);
\draw [color=blue] plot [smooth] coordinates {(0,0) (-28:1) (-56:2) (-84:3) (-112:4) (-140:5)};  \fill [fill=white] plot [smooth] coordinates {(0,0) (-28:1) (-56:2) (-84:3) (-112:4) (-140:5)};

\foreach \i in {5,...,1} {
    \node [anchor=south] at (10:\i) {W\i};
    \draw [black, dashed, very thin] ++(10:\i) arc (10:-195:\i);
}

\foreach \i in {0,...,3} {
    \pgfmathsetmacro\angleresult{\i * -60 };
    \pgfmathsetmacro\mylabel{\i * 60 };
    \draw [gray, dashed] (0,0) -- (\angleresult:5.5);
    \node [anchor=north] at (\angleresult:5.5) {\mylabel\textdegree};
}

\draw [black, very thick](0,0) -- (6:5);

\end{tikzpicture}%
\end{document}
6

Do you want something like this?

shading

\documentclass[tikz,border=5pt]{standalone}
\usepackage{textcomp}
\begin{document}
  \begin{tikzpicture}

    \begin{scope}
        \clip (0,0) -- (6:5) arc (6:-140:5) -- (0,0);
        \shade [inner color=red, outer color=white] (0,0) circle (5);
    \end{scope}

    \draw [color=blue] plot [smooth] coordinates {(0,0) (-28:1) (-56:2) (-84:3) (-112:4) (-140:5)};  \fill [fill=white] plot [smooth] coordinates {(0,0) (-28:1) (-56:2) (-84:3) (-112:4) (-140:5)};

    \foreach \i in {5,...,1} {
      \node [anchor=south] at (10:\i) {W\i};
      \draw [black, dashed, very thin] ++(10:\i) arc (10:-195:\i);
    }

    \foreach \i in {0,...,3} {
      \pgfmathsetmacro\angleresult{\i * -60 };
      \pgfmathsetmacro\mylabel{\i * 60 };
      \draw [gray, dashed] (0,0) -- (\angleresult:5.5);
      \node [anchor=north] at (\angleresult:5.5) {\mylabel\textdegree};
    }

    \draw [black, very thick](0,0) -- (6:5);

  \end{tikzpicture}%
\end{document}
| improve this answer | |
  • That is exactly what I want. Layering the shading underneath the plot is neat - I guess there's no easy way to do it all-in-one (no layering required)? – simont Jan 9 '15 at 3:18
  • @simont It isn't on a different layer. The scope is used to limit the effect of the \clip. Otherwise, it would affect your whole diagram and nothing outside that path would appear at all. (It would all be clipped.) – cfr Jan 9 '15 at 3:19
  • Oh. :) facepalm that does make sense. Thank you very much indeed. – simont Jan 9 '15 at 3:23

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.