%20%EC%82%AC%EC%9D%B4%EC%9D%98%20%EC%83%81%ED%98%B8%20%EC%9E%91%EC%9A%A9.png)
를 사용하는 동안 내 플롯의 영역을 음영 처리하고 싶습니다 axes equal=true
. 그러나 내가 예상했던 것 중 일부는 음영 처리되어 있지 않습니다. 이게 내 MWE야
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\begin{axis}[
axis equal=true,
axis lines=middle,
axis on top,
ticks=none,
xmin=-3,xmax=3,
ymin=-3,ymax=3,
]
\addplot[draw=none,fill=gray!20!white] (-3,-3) -- (-1.125,-3) -- (0.375,3) -- (-3,3) -- cycle;
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}
그리고 이것이 내가 얻는 결과입니다
어떤 이유로 를 사용하면 equal axis=true
x축이 값 이상으로 확장되어 xmin
음영 처리된 영역이 너무 작아집니다. 그러나 지침을 주석 처리하면 equal axis=true
음영 처리된 영역이 내가 원하는 대로 정확하게 표시됩니다(그러나 equal axis=true
그리려는 수직선이 실제로 수직으로 보이도록 하려면 지침이 필요합니다).
답변1
pgfplots 매뉴얼에서는 다음과 같이 언급합니다(섹션 4.10.1 공통 확장 옵션, 강조 내 항목).
/pgfplots/axis equal={true,false}
각 단위 벡터는 동일한 길이로 설정되고 축 크기는 일정하게 유지됩니다. 이후에는 x와 y의 각 단위에 대한 크기 비율이 동일해집니다.
축 제한이 확대됩니다.스케일링 효과를 보상하기 위해.
따라서 실제로 xmin
설정이 존중되지 않습니다. 예제 뒤에 매뉴얼에서는 다음과 같이 언급합니다.
구성은
axis equal=true
실제로unit vector ratio=1 1 1, unit rescale keep size=true
.
찾는 중 unit rescale keep size
:
/pgfplots/unit rescale keep size=true|false|unless limits declared
기본 구성에서 pgfplots는 단위 벡터 비율에 다른 스케일링이 포함되어 있어도 원래 축 크기를 유지합니다. 한도를 확대하여 그렇게 합니다.
이를 설정하면 변경이 unless limits declared
방지됩니다 xmin
. 이 설정( 과 결합)이 실제로 동일한 축을 생성하는지 100% 확신할 수는 없지만 unit vector ratio=1 1 1
작동하는 것 같습니다. 암호:
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\begin{axis}[
%axis equal=true,
unit vector ratio=1 1 1,
unit rescale keep size=unless limits declared,
axis lines=middle,
axis on top,
ticks=none,
xmin=-3,xmax=3,
ymin=-3,ymax=3,
]
\addplot[draw=none,fill=gray!20!white] (-3,-3) -- (-1.125,-3) -- (0.375,3) -- (-3,3) -- cycle;
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}