PGFPLOTS 如何在不增加標記邊框寬度的情況下增加線寬

PGFPLOTS 如何在不增加標記邊框寬度的情況下增加線寬
    \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}

在此輸入影像描述

相關內容