
나는 이것에 대한 간단한 대답을 찾고 있었지만 성공하지 못했습니다. y=x^2 함수를 플롯하고 환경으로 구성된 전체 상자의 배경색을 지정하고 싶습니다 axis
. 직관적으로 누군가 fill
는 에 옵션을 사용할 수 있다고 생각하겠지만 axis
실제로는 그렇지 않습니다! 이에 대한 간단한 해결책은 없나요? 또한, 상자 밖으로 색상을 확장하고 싶다면 어떻게 해야 할까요 axis
?
물론 수동으로 직사각형을 추가하고 필요에 따라 크기를 조정할 수 있지만 이는 편리하지 않습니다.
\documentclass{article}
\usepackage{tikzplot}
\begin{document}
\begin{tikzpicture}
\begin{axis}[fill = grey!10,] % This option does not work, why????
\addplot {x^2};
\end{axis}
\end{tikzpicture}
\end{document}
답변1
pgfplots 문서의 95페이지에서 확인하세요. 환경 axis background/.style
을 위해 사용하세요 axis
!
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}[axis background/.style={fill=gray!10}]
\addplot {x^2};
\end{axis}
\end{tikzpicture}
\end{document}