pgfplots:减少标记大小

pgfplots:减少标记大小

您知道怎样才能减小标记的尺寸吗?

代码:

\documentclass{book}


\usepackage{caption}
\usepackage{subcaption}
\usepackage{epsfig}
\usepackage{contour}




\usepackage{bm}        
\usepackage{colortbl}
\usepackage{enumitem}
\usepackage{makecell}
\usepackage[font=footnotesize]{caption}
\usepackage{forest}
\usetikzlibrary{shadows,arrows.meta}
\usepackage{pgfplotstable}
%\usepackage{filecontents}
\usepackage{graphicx}
\usepackage{pgfplots}
%\pgfplotsset{compat=newest}
\pgfplotsset{compat=1.16}
\usepackage{smartdiagram}


\usetikzlibrary{%
    arrows,%
    calc,%
    arrows.meta,
    fit,%
    patterns,%
    plotmarks,%
    shadows,
    shapes.geometric,%
    shapes.misc,%
    shapes.symbols,%
    shapes.arrows,%
    shapes.callouts,%
    shapes.multipart,%
    shapes.gates.logic.US,%
    shapes.gates.logic.IEC,%
    er,%
    automata,%
    backgrounds,%
    chains,%
    topaths,%
    trees,%
    petri,%
    mindmap,%
    matrix,%
    % calendar,%
    folding,%
    fadings,%
    through,%
    positioning,%
    scopes,%
    decorations.fractals,%
    decorations.shapes,%
    decorations.text,%
    decorations.pathmorphing,%
    decorations.pathreplacing,%
    decorations.footprints,%
    decorations.markings,%
    shadows}
\usetikzlibrary{arrows.meta,bending,positioning,calc}


\usepackage{listings}
\usepackage{color}

\begin{document}

\begin{figure}

    \begin{subfigure}[b]{0.5\textwidth}

        \begin{tikzpicture}
        \begin{axis}[ 
        width=\linewidth,
        line width=0.5,
        grid=major, % Display a grid
        tick label style={font={\tiny }},
        legend style={nodes={scale=0.6, transform shape}},
        label style={font={\tiny }},
        legend image post style={},
        grid style={white},
        xlabel={Epochs},
        ylabel={RMSE},
        y tick label style={
            /pgf/number format/.cd,
            fixed,
            fixed zerofill,
            precision=2
        },
        legend style={at={(1,0.95)}, anchor=north east, line width=.3pt,mark size=.4pt, draw=none, fill=none}
        ]
        \addplot[yellow!85!black,mark=diamond*] table[x expr=\coordindex,y index=0] {
        1.1256
        0.9999
        0.9737
        0.9623
        0.9558
        0.9517
        0.9487
        0.9465
        0.9451
        0.9439
        0.943
        0.9425
        0.9416
        0.9411
        0.941
        0.9403
        0.9401
        0.94
        0.9403
        0.9395
        0.94
        0.94
        0.9392
        0.9395
        0.9391
        0.9399
        0.9394
        0.9396
        0.9394
        0.9393
        0.939
        0.939
        0.9392
        0.9393
        0.9389
        0.939
        0.9389
        0.9393
        0.9396
        0.9391
        0.9393
        0.939
        0.9387
        0.9394
        0.9392
        0.9393
        0.9396
        0.939
        0.9388
        0.9392


        };
        \addlegendentry{Test error} 

        \end{axis}

        \end{tikzpicture}

        \subcaption{ 100K}
        \label{fig:sub11}
    \end{subfigure}
    \begin{subfigure}[b]{0.5\textwidth}
        \begin{tikzpicture}
        \begin{axis}[ 
        width=\linewidth,
        line width=0.5,
        grid=major, % Display a grid
        tick label style={font={\tiny}},
        legend style={nodes={scale=0.6, transform shape}},
        label style={font={\tiny }},
        legend image post style={},
        grid style={white},
        xlabel={Epochs},
        ylabel={RMSE},
        y tick label style={
            /pgf/number format/.cd,
            fixed,
            fixed zerofill,
            precision=2
        },
        legend style={at={(1,0.95)}, anchor=north east,  draw=none, fill=none},
        ]
        \addplot[blue,mark=*] table[x expr=\coordindex,y index=0] {
            1.1171
            0.9368
            0.9208
            0.9154
            0.9128
            0.9116
            0.9105
            0.9098
            0.9096
            0.9094
            0.909
            0.9092
            0.909
            0.9089
            0.9087
            0.9088
            0.909
            0.909
            0.9085
            0.9088
            0.9086
            0.9087
            0.9086
            0.9088
            0.9087
            0.9088
            0.9087
            0.9089
            0.9087
            0.9086
            0.9087
            0.9086
            0.9088
            0.9088
            0.9086
            0.9087
            0.9088
            0.9087
            0.9088
            0.9086
            0.9089
            0.9088
            0.9087
            0.9088
            0.9088
            0.9087
            0.9089
            0.9088
            0.9089
            0.9087




        };
        \addlegendentry{Test} 

        \end{axis}

        \end{tikzpicture}


        \subcaption{1M}
        \label{fig:sub22}

    \end{subfigure}

    \caption{Performance.}
    \label{tablex}
\end{figure}


\end{document}

在此处输入图片描述

答案1

mark size这样做。这里我设置mark size1pt,你可能需要更大的数字。

\documentclass{book}


\usepackage{caption}
\usepackage{subcaption}
\usepackage{epsfig}
\usepackage{contour}




\usepackage{bm}        
\usepackage{colortbl}
\usepackage{enumitem}
\usepackage{makecell}
\usepackage[font=footnotesize]{caption}
\usepackage{forest}
\usetikzlibrary{shadows,arrows.meta}
\usepackage{pgfplotstable}
%\usepackage{filecontents}
\usepackage{graphicx}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepackage{smartdiagram}


\usetikzlibrary{%
    arrows,%
    calc,%
    arrows.meta,
    fit,%
    patterns,%
    plotmarks,%
    shadows,
    shapes.geometric,%
    shapes.misc,%
    shapes.symbols,%
    shapes.arrows,%
    shapes.callouts,%
    shapes.multipart,%
    shapes.gates.logic.US,%
    shapes.gates.logic.IEC,%
    er,%
    automata,%
    backgrounds,%
    chains,%
    topaths,%
    trees,%
    petri,%
    mindmap,%
    matrix,%
    % calendar,%
    folding,%
    fadings,%
    through,%
    positioning,%
    scopes,%
    decorations.fractals,%
    decorations.shapes,%
    decorations.text,%
    decorations.pathmorphing,%
    decorations.pathreplacing,%
    decorations.footprints,%
    decorations.markings,%
    shadows}
\usetikzlibrary{arrows.meta,bending,positioning,calc}


\usepackage{listings}
\usepackage{color}

\begin{document}

\begin{figure}

    \begin{subfigure}[b]{0.5\textwidth}

        \begin{tikzpicture}
        \begin{axis}[ 
        width=\linewidth,
        line width=0.5,
        grid=major, % Display a grid
        tick label style={font={\tiny }},
        legend style={nodes={scale=0.6, transform shape}},
        label style={font={\tiny }},
        legend image post style={},
        grid style={white},
        xlabel={Epochs},
        ylabel={RMSE},
        y tick label style={
            /pgf/number format/.cd,
            fixed,
            fixed zerofill,
            precision=2
        },
        legend style={at={(1,0.95)}, anchor=north east, line width=.3pt,mark size=.4pt, draw=none, fill=none}
        ]
        \addplot[yellow!85!black,mark=diamond*,mark size=1pt] table[x expr=\coordindex,y index=0] {
        1.1256
        0.9999
        0.9737
        0.9623
        0.9558
        0.9517
        0.9487
        0.9465
        0.9451
        0.9439
        0.943
        0.9425
        0.9416
        0.9411
        0.941
        0.9403
        0.9401
        0.94
        0.9403
        0.9395
        0.94
        0.94
        0.9392
        0.9395
        0.9391
        0.9399
        0.9394
        0.9396
        0.9394
        0.9393
        0.939
        0.939
        0.9392
        0.9393
        0.9389
        0.939
        0.9389
        0.9393
        0.9396
        0.9391
        0.9393
        0.939
        0.9387
        0.9394
        0.9392
        0.9393
        0.9396
        0.939
        0.9388
        0.9392


        };
        \addlegendentry{Test error} 

        \end{axis}

        \end{tikzpicture}

        \subcaption{ 100K}
        \label{fig:sub11}
    \end{subfigure}
    \begin{subfigure}[b]{0.5\textwidth}
        \begin{tikzpicture}
        \begin{axis}[ 
        width=\linewidth,
        line width=0.5,
        grid=major, % Display a grid
        tick label style={font={\tiny}},
        legend style={nodes={scale=0.6, transform shape}},
        label style={font={\tiny }},
        legend image post style={},
        grid style={white},
        xlabel={Epochs},
        ylabel={RMSE},
        y tick label style={
            /pgf/number format/.cd,
            fixed,
            fixed zerofill,
            precision=2
        },
        legend style={at={(1,0.95)}, anchor=north east,  draw=none, fill=none},
        ]
        \addplot[blue,mark=*,mark size=1pt] table[x expr=\coordindex,y index=0] {
            1.1171
            0.9368
            0.9208
            0.9154
            0.9128
            0.9116
            0.9105
            0.9098
            0.9096
            0.9094
            0.909
            0.9092
            0.909
            0.9089
            0.9087
            0.9088
            0.909
            0.909
            0.9085
            0.9088
            0.9086
            0.9087
            0.9086
            0.9088
            0.9087
            0.9088
            0.9087
            0.9089
            0.9087
            0.9086
            0.9087
            0.9086
            0.9088
            0.9088
            0.9086
            0.9087
            0.9088
            0.9087
            0.9088
            0.9086
            0.9089
            0.9088
            0.9087
            0.9088
            0.9088
            0.9087
            0.9089
            0.9088
            0.9089
            0.9087




        };
        \addlegendentry{Test} 

        \end{axis}

        \end{tikzpicture}


        \subcaption{1M}
        \label{fig:sub22}

    \end{subfigure}

    \caption{Performance.}
    \label{tablex}
\end{figure}


\end{document}

但我的建议是:根本不要使用标记......

答案2

不确定,我明白了,是因为您的代码中已经有了解决方案(错误的位置)?!

只需添加mark size = 0.4pt到您的\addplot命令中:\addplot[mark = diamond*, mark size = 0.4pt]

相关内容