
プロットにインセットを追加しようとしています。この答えをガイドとして開始するには、インセット プロットが透明です。axis background/.style={fill=white}
インセット プロットに追加すると背景は修正されますが、周囲の軸ラベルは修正されません。これを拡張して領域全体をカバーできる方法はありますか? 問題は、次の画像から明らかだと思います。
spy
インセットにはより詳細なデータ ファイルを使用しているため、ライブラリは使用していません。
\begin{figure} % CONTINUOUS SCAN INSET
\centering
\begin{tikzpicture}
\begin{axis}[
width = 14cm,
height = 8cm,
title = {50 $\mu$m scintillator probe continuous scan},
xlabel = {Position (mm)},
ylabel = {Response (\% of Maximum)},
axis lines = left,
ymax = 110,
ymin=0,
xmin = 3,
]
\addplot[blue] table[x=x,y=y]{../../AS Data/ProcessedData/50um-profile.txt};
\coordinate (insetPosition) at (rel axis cs:0.35,0.15);
\end{axis}
\begin{axis}[at={(insetPosition)},anchor={outer south west},footnotesize,axis background/.style={fill=white},
axis lines = left,
ymax = 110,
ymin=0,
xmin = 19,
xmax = 21,
xtick = {19,19.4,...,21}
]
\addplot[blue] table[x=x,y=y]{../../AS Data/ProcessedData/50um-profile-subsection-small.txt};
\end{axis}
\end{tikzpicture}
\caption{Continuous scan through the field (inset).}
\label{}
\end{figure}
答え1
ステファン・ピノウに感謝関連するソリューションへのリンク軸の前に新しい pgf レイヤーを宣言します。
\pgfdeclarelayer{background} \pgfdeclarelayer{foreground} \pgfsetlayers{background,main,foreground}
次を使用して、各軸を適切なレイヤー内にネストします。
\begin{pgfonlayer}{background}
などを設定し、メインレイヤーに白い四角形を含めると、目的の結果が得られました。
\begin{pgfonlayer}{main}
\fill [black!0] ([shift={(-2pt,-2pt)}] insetAxis.outer south west)
rectangle ([shift={(+5pt,+5pt)}] insetAxis.outer north east);
\end{pgfonlayer}
完全な TeX コード:
\begin{figure} % CONTINUOUS SCAN INSET
\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}
\centering
\begin{tikzpicture}
\begin{pgfonlayer}{background}
\begin{axis}[
width = 14cm,
height = 8cm,
title = {50 $\mu$m scintillator probe continuous scan},
xlabel = {Position (mm)},
ylabel = {Response (\% of Maximum)},
axis lines = left,
ymax = 110,
ymin=0,
xmin = 3,
]
\addplot[blue] table[x=x,y=y]{../../AS Data/ProcessedData/50um-profile.txt};
\coordinate (insetPosition) at (rel axis cs:0.35,0.15);
\end{axis}
\end{pgfonlayer}
\begin{pgfonlayer}{foreground}
\begin{axis}[at={(insetPosition)},anchor={outer south west},footnotesize,axis background/.style={fill=white},
axis lines = left,
ymax = 110,
ymin=0,
xmin = 19,
xmax = 21,
xtick = {19,19.4,...,21},
name = insetAxis
]
\addplot[blue] table[x=x,y=y]{../../AS Data/ProcessedData/50um-profile-subsection-small.txt};
\end{axis}
\end{pgfonlayer}
\begin{pgfonlayer}{main}
\fill [black!0] ([shift={(-2pt,-2pt)}] insetAxis.outer south west)
rectangle ([shift={(+5pt,+5pt)}] insetAxis.outer north east);
\end{pgfonlayer}
\end{tikzpicture}
\caption{Continuous scan through the field (inset).}
\label{}
\end{figure}