"화살표 있음"(스타일에 설정됨)에서 "화살표 없음"으로 축 선 스타일을 재정의하는 방법을 알 수 없습니다.
MWE는 다음과 같습니다.
\documentclass[]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots,tikz}
\pgfplotsset{compat=newest}
\pgfplotsset{
axisStyle/.style={axis y line =left,
axis x line =bottom,
axis line style ={very thick}}
}
\begin{document}
\begin{figure}[htbc]
\centering
\begin{tikzpicture}
\begin{axis}
[ axisStyle,
axis y line=none,
axis y line*=left,
axis x line*=bottom,
ymax=5
]
\addplot[domain=-2:2] {x^2};
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}
보시다시피 단순히 선 스타일을 "화살표 없음"으로 설정하는 것만으로는 작동하지 않으며 처음에 없음으로 설정하는 것도 도움이 되지 않습니다.
참고: 실제로 내 스타일에는 훨씬 더 많은 옵션이 포함되어 있으므로 스타일을 사용하고 가능하면 두 설정만 변경하는 것이 여전히 합리적입니다.
답변1
축 선의 스타일을 수정하려면 를 사용합니다 <axis> axis line style={<styles>}
. 여기서 <axis>
는 수정할 축( 모든 축의 스타일을 지정하려면 x
, y
, z
또는 생략)이고 는 <styles>
적용할 스타일입니다.
따라서 옵션을 사용 axis line style={-}
하여 axis
축 axisStyle
선에 대한 화살표 팁을 무시하고 로컬로 설정할 수 있습니다. 여기서는 <axis>
축선이 하나만 그려지기 때문에 를 생략했지만 효과는 와 동일합니다 x axis line style
.
그 열쇠는첨부됨현재 설치된 축 선 스타일에 적용되므로 axis line style ={very thick}
from이 axisStyle
여전히 적용됩니다.
\documentclass[tikz]{standalone}
\usepackage{pgfplots,tikz}
\pgfplotsset{compat=1.12}
\pgfplotsset{
axisStyle/.style={
axis y line =left,
axis x line =bottom,
axis line style ={very thick},
}
}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axisStyle,
axis line style={-},
axis y line=none,
ymax=5,
]
\addplot[domain=-2:2] {x^2};
\end{axis}
\end{tikzpicture}
\end{document}