
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis lines = left,
enlarge x limits=0.1,
enlarge y limits=0.1,
]
\addplot [
mark=*,
color=blue,
scatter,
scatter/use mapped color={draw=black},
error bars/.cd,
y dir = both,
y explicit,
error bar style={color=black},
] table [x index=0, y index=1, y error index=2]{
0 2 0.1
2 0 0.1
};
\addplot [line width=2pt,
mark=*,
color=red,
scatter,
scatter/use mapped color={draw=black},
error bars/.cd,
y dir = both,
y explicit,
error bar style={color=black},
] table [x index=0, y index=1, y error index=2]{
0 0 0.1
2 2 0.1
};
\end{axis}
\end{tikzpicture}
\end{document}
마커 테두리 너비는 그대로 유지하면서 선 너비를 늘리려면 어떻게 해야 합니까?
답변1
mark options
마크의 매개변수를 제어하는 것이 목적입니다 . 따라서 다이얼링을 통해 mark options={line width=0.4pt}
선 너비를 표준 값으로 설정할 수 있습니다.
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis lines = left,
enlarge x limits=0.1,
enlarge y limits=0.1,
]
\addplot [
mark=*,
color=blue,
scatter,
scatter/use mapped color={draw=black},
error bars/.cd,
y dir = both,
y explicit,
error bar style={color=black},
] table [x index=0, y index=1, y error index=2]{
0 2 0.1
2 0 0.1
};
\addplot [line width=2pt,mark options={line width=0.4pt},
mark=*,
color=red,
scatter,
scatter/use mapped color={draw=black},
error bars/.cd,
y dir = both,
y explicit,
error bar style={color=black},
] table [x index=0, y index=1, y error index=2]{
0 0 0.1
2 2 0.1
};
\end{axis}
\end{tikzpicture}
\end{document}