2

Further on the posted question about Venn diagrams for fuzzy logic in TikZ, I have edited this tikzpictureinto a "customized version". My aim is-->

a)

To get a first diagram with both gaussian curves as in the MWE below, with a second diagram displaying the centers of the curves closer to each other, thus showing more overlap. The color of the first gaussian curve (uncertainty) should be brown and the second (risk) should be cyan.

b)

To have the color of this overlap as a hatch; displaying a thin hatch of cyan and then again a thin brown hatch. In my MWE, the color of the overlap area is darker already, but not pronounced enough.

Note: The brown is identified with the shade in the MWE below, the cyan is similar.

Here the MWE:

\documentclass{book}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{shapes,fadings,patterns}

\begin{document}

\pgfmathdeclarefunction{gauss}{2}{%
\pgfmathparse{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))}%
}
\pgfplotsset{
xticklabels=\empty,
yticklabels=\empty,
xtick=\empty,
ytick=\empty,
width=12cm,
height=6.5cm,
every axis plot post/.append style={ 
shade, top color=white, bottom color=brown!80!black!20, fill opacity=0.6,
mark=none, 
domain=-2:3,
samples=50,
smooth
},
ymax=1,
enlargelimits=upper,
}

%\begin{figure}
\begin{tikzpicture}       % 1th diagram
\begin{axis}
\begin{scope}
\clip[] (axis cs:-2,0) rectangle (axis cs:0.5,0.8);
\addplot[fill=black!90!white]{gauss(1,0.5)};
\end{scope} 
\begin{scope}
\clip[] (axis cs:0.5,0) rectangle (axis cs:4,0.8);
\addplot[fill=black!90!white]{gauss(0,0.5)};
\end{scope} 
\addplot[thick] {gauss(0,0.5)};
\addplot[thick] {gauss(1,0.5)};
\node at (axis cs:-0.3,0.875) {\textsc{uncertainty}};
\node at (axis cs:1.1,0.875) {\textsc{risk}};
\end{axis}
\end{tikzpicture}
\end{document}
4

I tried to simplify a bit and get the following:

\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{shapes,fadings,patterns}

\begin{document}

\pgfmathdeclarefunction{gauss}{2}{%
\pgfmathparse{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))}%
}
\pgfplotsset{
    xticklabels=\empty,
    yticklabels=\empty,
    xtick=\empty,
    ytick=\empty,
    width=12cm,
    height=6.5cm,
    every axis plot post/.append style={ 
    shade, fill opacity=0.8,
    top color=white,
    mark=none, 
    domain=-2:3,
    samples=50,
    smooth
    },
    ymax=1,
    enlargelimits=upper,
}
\pgfsetblendmode{multiply}

%\begin{figure}
\begin{tikzpicture}       % 1th diagram
    \begin{axis}
        \addplot[thick,bottom color=blue!80!black!20,] {gauss(0,0.5)};
        \addplot[thick,bottom color=brown!80!black!20,] {gauss(0.6,0.5)};
        \node at (axis cs:-0.3,0.875) {\textsc{uncertainty}};
        \node at (axis cs:0.7,0.875) {\textsc{risk}};
    \end{axis}
\end{tikzpicture}
\end{document}

You may play with the blend modes: normal, compatible, screen, multiply, hardLight, darken, lighten, difference, colorDodge, colorBurn, softLight, hue, saturation, luminosity, overlay, exclusion or color.

enter image description here

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.