以前、次の質問で、オプションのサブプロットを含むテーブル内でグラフを整列および配置する方法について助けられました。入力から2つの.tikzファイルをオーバーレイする
うまく機能しましたが、グラフを縮小するためのスケーリング オプションを使用するのは満足できませんでした。幅と高さを指定するだけで、LaTeX にフォント サイズを任せる方がはるかに便利です。これにより、記事の一貫性が大幅に向上しました。
したがって、グラフを作成するときは、プリアンブルで一括して幅と高さを設定できるスタイルを指定してから、その下のグラフに関連する個々のエントリを編集します。
残念ながら、このシステムを使用すると、再び配置が崩れてしまいました。配置が残るのは、プリアンブル内のすべてのエントリを定義するカスタム スタイルを使用するか、カスタム スタイルをまったく使用せず、.tikz 画像の幅と高さを同じに設定する場合のみのようです。
私の問題を示す完全な MWE:
\documentclass{article}
\usepackage{graphicx,array,booktabs,pgfplots}
\pgfplotsset{compat=1.9}
\usetikzlibrary{calc}
\pgfplotsset{inTable/.style={
width=4.0cm,
height=4.0cm,
}}
\newsavebox{\mybox}
\sbox{\mybox}{
\begin{tikzpicture}
\begin{axis}[inTable,
scale only axis,
xmin=1,
xmax=500,
xlabel={A},
ymin=0.5,
ymax=1,
ylabel={A}]
\addplot [color=blue,solid,line width=1.0pt,forget plot]
table[row sep=crcr]{
10 0.7 \\
11 0.7 \\
12 0.7 \\
};
\end{axis}
\end{tikzpicture}}
\newsavebox{\myboxB}
\sbox{\myboxB}{
\begin{tikzpicture}
\begin{axis}[inTable,
scale only axis,
xmin=1,
xmax=200,
xlabel={B},
ymin=0,
ymax=3,
ylabel={B}]
\addplot [color=blue,solid,line width=1.0pt,forget plot]
table[row sep=crcr]{
10 0.5 \\
11 0.6 \\
12 0.7 \\
};
\end{axis}
\end{tikzpicture}}
\begin{document}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\begin{table}[htb!]
\centering
\begin{tabular}{P{6.5cm} P{6.5cm}}
\toprule
Expt1 & Expt2\\
\cmidrule(r){1-1}\cmidrule(l){2-2}
\begin{tikzpicture}[baseline=(a.base)]
\node[outer sep=0pt] (a){\usebox{\mybox}};
%%% Change dimensions in $(a.east)+(-0.9,0cm)$
% \node[anchor=east,outer sep=0pt] at
% ($(a.east)+(-0.9,0cm)$){\usebox{\mybox}};
\end{tikzpicture}
{\usebox{\mybox}}
&
{\usebox{\mybox}}
{\usebox{\myboxB}}
\\ \bottomrule
\end{tabular}
\caption{Test}
\label{tbl:1}
\end{table}
\end{document}
ご協力をよろしくお願いします。これが私のテーブル グラフ インセット プロット プロトコルの最終部分になるはずです。
答え1
わかりました。ありがとう、Torbjørn T。マニュアルのおかげで記憶が蘇りました。
まず、左上の画像は実際には環境{tikzpicture}
内のものな\begin{tikzpicture}
ので、右上の画像でも同じことを行う必要がありました。次に、[baseline, trim axis left, trim axis right]
それぞれに配置フラグ\begin{tikzpicture}
(実際のドキュメントの .tikz ファイルからインポートしたもの) を追加して、配置を修正します。
ついに、プロットとサブプロットの完全な調整と制御を行う方法が見つかりました。ご協力いただいた皆様に感謝します。
完全なMEW:
\documentclass{article}
\usepackage{graphicx,array,booktabs,pgfplots}
\pgfplotsset{compat=1.9}
\usetikzlibrary{calc}
\pgfplotsset{inTable/.style={
width=4.0cm,
height=4.0cm, %Change these numbers to ovveride all graphs in the table sizes in the table
}}
\newsavebox{\mybox}
\sbox{\mybox}{
\begin{tikzpicture}[baseline, trim axis left, trim axis right]
\begin{axis}[inTable,
scale only axis,
baseline,
xmin=1,
xmax=500,
xlabel={A},
ymin=0.5,
ymax=1,
ylabel={A}]
\addplot [color=blue,solid,line width=1.0pt,forget plot]
table[row sep=crcr]{
10 0.7 \\
11 0.7 \\
12 0.7 \\
};
\end{axis}
\end{tikzpicture}}
\newsavebox{\myboxB}
\sbox{\myboxB}{
\begin{tikzpicture}[baseline, trim axis left, trim axis right]
\begin{axis}[inTable,
scale only axis,
xmin=1,
xmax=200,
xlabel={B},
ymin=0,
ymax=3,
ylabel={B}]
\addplot [color=blue,solid,line width=1.0pt,forget plot]
table[row sep=crcr]{
10 0.5 \\
11 0.6 \\
12 0.7 \\
};
\end{axis}
\end{tikzpicture}}
\begin{document}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\begin{table}[htb!]
\centering
\begin{tabular}{P{6.5cm} P{6.5cm}}
\toprule
Expt1 & Expt2\\
\cmidrule(r){1-1}\cmidrule(l){2-2}
\begin{tikzpicture}[baseline=(a.base)]
\node[outer sep=0pt] (a){\usebox{\mybox}};
%%% Change dimensions in $(a.east)+(-0.9,0cm)$
% \node[anchor=east,outer sep=0pt] at
% ($(a.east)+(-0.9,0cm)$){\usebox{\mybox}};
\end{tikzpicture}
{\usebox{\mybox}}
&
\begin{tikzpicture}[baseline=(a.base)]
\node[outer sep=0pt] (a){\usebox{\mybox}};
%%% Change dimensions in $(a.east)+(-0.9,0cm)$
% \node[anchor=east,outer sep=0pt] at
% ($(a.east)+(-0.9,0cm)$){\usebox{\mybox}};
\end{tikzpicture}
{\usebox{\myboxB}}
\\ \bottomrule
\end{tabular}
\caption{Test}
\label{tbl:1}
\end{table}
\end{document}