
나는종횡비pgfplots는 너비와 높이를 명시적으로 지정하지 않고 플롯합니다(즉, 기본값으로 둡니다). 3D 플롯의 경우 plot box ratio
; 2D 플롯의 경우 를 사용해 보았지만 \axisdefaultheight
비율이 맞지 않습니다.
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xmin=0.0, xmax=3.0,
ymin=0.0, ymax=1.0,
scale only axis,
width=2\axisdefaultheight
]
\addplot [red]
table {%
0 0
0.1 0.587785252292473
0.2 0.951056516295154
0.3 0.951056516295154
0.4 0.587785252292473
0.5 1.22464679914735e-16
0.6 -0.587785252292473
0.7 -0.951056516295154
0.8 -0.951056516295154
0.9 -0.587785252292473
1 -2.44929359829471e-16
1.1 0.587785252292474
1.2 0.951056516295154
1.3 0.951056516295154
1.4 0.587785252292473
1.5 3.67394039744206e-16
1.6 -0.587785252292473
1.7 -0.951056516295154
1.8 -0.951056516295154
1.9 -0.587785252292473
};
\end{axis}
\end{tikzpicture}
\end{document}
이 옵션은 unit vector ratio
실제 축 제한을 고려하므로 약간의 계산 후에 사용할 수 있습니다. 하지만 축 길이에 대해서만 설정을 찾고 있습니다.
힌트가 있나요?
답변1
\axisdefaultheight
길이가 아니라 매크로이므로 2\axisdefaultheight
작동하지 않지만 2*\axisdefaultheight
작동합니다. 하지만 너비와 높이를 모두 지정하는 것이 아마도 가장 간단한 옵션일 것입니다.
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xmin=0.0, xmax=3.0,
ymin=0.0, ymax=1.0,
scale only axis,
height=\axisdefaultheight,
width=2*\axisdefaultheight
]
\addplot [red]
table {%
0 0
0.1 0.587785252292473
0.2 0.951056516295154
0.3 0.951056516295154
0.4 0.587785252292473
0.5 1.22464679914735e-16
0.6 -0.587785252292473
0.7 -0.951056516295154
0.8 -0.951056516295154
0.9 -0.587785252292473
1 -2.44929359829471e-16
1.1 0.587785252292474
1.2 0.951056516295154
1.3 0.951056516295154
1.4 0.587785252292473
1.5 3.67394039744206e-16
1.6 -0.587785252292473
1.7 -0.951056516295154
1.8 -0.951056516295154
1.9 -0.587785252292473
};
\end{axis}
\end{tikzpicture}
\end{document}