
Ich habe das folgende MWE, das zwei verblassende, ausgefüllte Kreise zeichnet:
\documentclass{article}
\usepackage{pgfplots}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\fill[inner color=red,outer color=white] (0,0) circle (1.8);
\begin{scope}[xshift=4cm]
\fill[inner color=red,outer color=white] (0,0) circle (1.8);
\end{scope}
\end{tikzpicture}
\end{document}
Ich möchte den Umfang xshift
auf 3 cm ändern. Das Problem ist, dass sich die Kreise überlappen, wobei der rechte Kreis auf dem linken Kreis liegt. Ich möchte stattdessen die Farbintensität konstruktiv hinzufügen.
Eine separate Frage: Wie kann ich den Kreisen ohne Achsen eine Gauß-Funktion hinzufügen? Die Beispiele, die ich auf der TikZ-Site gesehen habe, verwendeten das Paket pgfplots, das die Achsen zeichnet.
Antwort1
Wir verwenden die fadings
Bibliothek (suchen Sie die \tikzfading
Dokumentation im PGF/TikZ-Handbuch.)
Die Ausgabe
Ich fand, dass es mit den beiden roten Scheiben nicht besonders schön aussah, deshalb habe ich eine durch eine blaue ersetzt.
Der Code
\documentclass[tikz]{standalone}
\usetikzlibrary{fadings}
\tikzfading %strangely gives bad bounding box when inside the tikzpicture
[
name=fade out,
inner color=transparent!0,
outer color=transparent!100
]
\begin{document}
\begin{tikzpicture}
\tikzset
{
myCircle/.style=
{
red,
path fading=fade out,
}
}
\def\a{1}
\fill[myCircle] (-\a,0) circle (1.8);
\fill[myCircle, blue,] (\a,0) circle (1.8);
\draw plot [samples=200] (\x, {exp(-.5*(\x)^2)}) ;
\end{tikzpicture}
\end{document}
Antwort2
Ich bin mir nicht ganz sicher, wie das funktioniert, aber ich glaube, du brauchst Fadings
Abschnitt 23.4 aus dem TikZ-Handbuch. So etwas wie das hier:
\documentclass[border=0.2 cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{fadings}
\begin{document}
\tikzfading[name=fade inside,
inner color=transparent!0,
outer color=transparent!30]
\begin{tikzpicture}
\shade[ball color=red,path fading=fade inside] (0,0) circle (1.8);
\begin{scope}[xshift=3cm]
\shade[ball color=red,path fading=fade inside] (0,0) circle (1.8);
\end{scope}
\end{tikzpicture}
\end{document}