5

With my MWE

\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{fadings}
\begin{document}
\begin{tikzpicture}
  \colorlet{ok}{green!25!}
  \colorlet{bad}{red!20!}
  \fill[ok]     (0,0) -- (0,6) -- (6,6) -- (6,0) -- cycle;
  \fill[bad, path fading=south,fading angle=-45]
                (0,0) -- (0,6) -- (6,6) -- (6,0) -- cycle;
  \draw[black]  (0,0) -- (0,6) -- (6,6) -- (6,0) -- (0,0);
\end{tikzpicture}
\end{document}

I get the following Image (without the black line): enter image description here How can I achieve a fading that is radial an centered in the lower left corner. Just with a fading along an arc like the black line in the Image above?

7

Rewriting your code, you can use the main square as a \clip, then place a circle at the lower left with a radius equal to the square's side. You can then apply a path fading to this circle.

Also, switch from minimal to standalone for single graphics.

Output

enter image description here

Code

\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{fadings}
\tikzfading[name=fade out, 
    inner color=transparent!0,
    outer color=transparent!100]

\colorlet{ok}{green!25!}
\colorlet{bad}{red!20!}

\begin{document}
\begin{tikzpicture}
    \clip[preaction={fill=ok, draw=black}] (0,0) rectangle (6,6);
    \fill[bad, path fading=fade out, draw=none] (0,0) circle (6cm);
\end{tikzpicture}
\end{document}
  • Thats nice. But you switched the colors, red should be atop ;) – Phil Aug 25 '16 at 21:42
  • @Phil Shouldn't the top layer use a larger circle or is the point that that's not wanted? – cfr Aug 25 '16 at 22:05
  • It should be larger. But with increasing the radius it should come closer to the black line. Haven't tested yet. Just on the Phone right now. – Phil Aug 25 '16 at 22:09
5

I think you are looking for a shading instead.

\documentclass[tikz]{standalone}
\usetikzlibrary{shadings}
\makeatletter
\pgfdeclareradialshading[tikz@radial@inner,tikz@radial@outer]%
{sw radial}%
{\pgfqpoint{-50bp}{-50bp}}%
{%
color(0bp)=(tikz@radial@inner);%
color(10bp)=(tikz@radial@outer!5!tikz@radial@inner);%
color(25bp)=(tikz@radial@outer!30!tikz@radial@inner);%
color(40bp)=(tikz@radial@outer!65!tikz@radial@inner);%
color(45bp)=(tikz@radial@outer!85!tikz@radial@inner);%
color(50bp)=(tikz@radial@outer)}
\makeatother
\pgfuseshading{sw radial}

\begin{document}
\begin{tikzpicture}[]

  \shade[inner color=yellow,outer color=blue,shading=sw radial] 
        (0,0) -- (0,6) -- (6,6) -- (6,0) -- cycle;

\end{tikzpicture}
\end{document}

Now because I'm lazy I quickly snatched the defition of the predefined radial shading and fiddled with it. That has one consequence: you have to write the name of the shading after the inner outer color specification. Otherwise it will automatically assume shading=radial.

And I'm colorblind so you can adjust the transition better.

enter image description here

5

I'm not clear what you are trying to do: possibly what Alenanno suggested; possibly something else. Here are some possible something elses. The first 3 seem plausible interpretations. The lower right one is just because I ran out of plausible interpretations and didn't like the resultant asymmetry.

3 plaus

\documentclass[border=10pt,multi,tikz]{standalone}% never use minimal for examples - it isn't suitable
\begin{document}
\begin{tikzpicture}
  \colorlet{ok}{green!25!}
  \colorlet{bad}{red!20!}
  \begin{scope}
    \clip (0,0) rectangle (6,6);
    \fill [inner color=ok, outer color=bad] (0,0) circle ({6*(sqrt(2))});
    \draw [black,thick] (0,0) circle (5.5);
  \end{scope}
  \begin{scope}[xshift=65mm]
    \clip (0,0) -- ++(5.5,0) arc (0:90:5.5) -- cycle;
    \fill [inner color=ok, outer color=bad] (0,0) circle ({5.5*(sqrt(2))});
  \end{scope}
  \begin{scope}[yshift=-65mm]
    \clip (6,6) |- ++(-0.5,-6) arc (0:90:5.5) |- cycle;
    \fill [inner color=ok, outer color=bad] (0,0) circle ({6*(sqrt(2))});
  \end{scope}
  \begin{scope}[xshift=65mm,yshift=-65mm]
    \clip (6,6) |- ++(-0.5,-6) arc (0:90:5.5) |- cycle;
    \fill [inner color=ok, outer color=bad] ({2.75*(sqrt(2))},{2.75*(sqrt(2))}) circle ({3.5*(sqrt(2))});
  \end{scope}
\end{tikzpicture}
\end{document}
  • These three something elses are three something elses i don't want. I already marked the right answer. But nice three something elses. I thougt I explained clear enough ;) – Phil Aug 25 '16 at 21:56
  • @Phil You hadn't marked the right answer when I posted this or I wouldn't have posted it. (Though sometimes there seems to be a lag in the system showing the page needs refreshing etc. so it may just have appeared to me that you hadn't when I posted.) As I say, I didn't think it was at all clear, which is why you've got three different answers, even if you only count mine as one. What did you mean by bow? Anyway, if you don't mind, I'll leave these in case they are useful to somebody else at some point. – cfr Aug 25 '16 at 22:02
  • I thougt the heading would be clear ;) – Phil Aug 25 '16 at 22:06
  • @Phil It is that the content of the question then seems to ask something else ;). Or maybe I'm just dumb. Other people seem to have understood. – cfr Aug 25 '16 at 22:25

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.