我有以下图表,但无论我选择的高度是多少,它都不会影响图表高度。它唯一起作用的方式是当我使用仅缩放轴选项时,但我并不想这样做。这是怎么回事?
\begin{tikzpicture}
\begin{axis}[width=3cm,
height=6cm,
footnotesize,
xmin=1,
xmax=15,
xlabel={X},
xmajorgrids,
ymin=0.2,
ymax=1.2,
ylabel={Y},
ymajorgrids,
axis background/.style={fill=white},
legend style={legend cell align=left,at={(axis cs:0.,0.2)},anchor=south}
]
\addplot [color=mycolor1c,dashed,mark size=5pt,mark=x,mark options={solid}]
table[row sep=crcr, y expr=\thisrow{Y}*.5]{%
X Y\\
1 1.98396947369363\\
2 1.86736194644617\\
3 1.39672685380491\\
4 1.81801351792524\\
5 1.65800541448776\\
6 1.72124859501669\\
7 1.95053632111296\\
8 1.5953158074501\\
9 2.20484922246232\\
10 2.06660239159798\\
11 1.15700938093597\\
12 1.70354273363983\\
13 1.97071496027903\\
14 1.5377824362414\\
15 1.34852389652374\\
};
\addlegendentry{1};
\addplot [color=mycolor3c,solid,mark size=3.0pt,mark=o,mark options={solid}]
table[row sep=crcr, y expr=\thisrow{Y}*.5]{%
X Y\\
1 1.98396947369363\\
2 1.87985797050402\\
3 1.81018984587384\\
4 1.45668153706335\\
5 1.45662344223124\\
6 1.42321790298663\\
7 1.58846550051792\\
8 1.7261014576169\\
9 1.84497235618249\\
10 1.83868784206141\\
11 1.91262415124094\\
12 1.87950764557444\\
13 1.16064983693758\\
14 1.28630813303169\\
15 0.729867599135851\\
};
\addlegendentry{2};
\addplot [color=mycolor2c,solid,mark size=3.0pt,mark=*,mark options={solid}]
table[row sep=crcr, y expr=\thisrow{Y}*.5]{%
X Y\\
1 1.98396947369363\\
2 1.58099605261815\\
3 1.25697492063651\\
4 1.46582314712387\\
5 1.3939586089965\\
6 1.32595119844705\\
7 1.41440624648194\\
8 1.53386555109464\\
9 1.7654715541107\\
10 1.54694708739791\\
11 1.53904078916298\\
12 1.66515096650716\\
13 1.09210648149942\\
14 1.2047294527546\\
15 0.647646671362433\\
};
\addlegendentry{3};
\end{axis}
\end{tikzpicture}%
答案1
Torbjørn T. 的回答对我有用:
切换选项的顺序。footnotesize 键设置(除其他外)高度,因此您的高度定义将被覆盖。使用 footnotesize,height=3cm,应该使用 3cm。– Torbjørn T. 9 月 9 日 21:10