
2 つのフェードする塗りつぶされた円を描く次の MWE があります。
\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}
スコープを 3cm に変更したいと思いますxshift
。問題は、右の円が左の円の上に配置されているため、円が重なり合ってしまうことです。代わりに、色の強度を建設的に追加したいと思います。
別の質問: 軸のない円の上にガウス関数を追加するにはどうすればよいですか? TikZ サイトで見た例では、軸を描画する pgfplots パッケージが使用されていました。
答え1
ライブラリを使用しますfadings
( \tikzfading
PGF/TikZ マニュアルでドキュメントを検索してください)。
出力
両方のディスクが赤いと見た目があまり良くないと思ったので、片方を青に変更しました。
コード
\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}
答え2
どのように動作するのか少しわかりませんが、Fadings
TikZ マニュアルのセクション 23.4 が必要だと思います。次のようになります。
\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}