2D Tikz 线图样式

2D Tikz 线图样式

我正在尝试获得类似于图片上的东西:

在此处输入图片描述

我不知道,它看起来很棒。也许是因为字体或一些我不知道的技巧。到目前为止,我能够绘制这个:

在此处输入图片描述

代码:

\documentclass[border=10pt]{standalone}

\usepackage{tikz}
\usepackage{pgfplots}\pgfplotsset{compat=1.9}


%%%>
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
  \begin{axis}[ 
  width=\linewidth,
  line width=0.5,
  grid=major, % Display a grid
  tick label style={font=\normalsize},
  legend style={nodes={scale=0.4, transform shape}},
  label style={font=\normalsize},
  legend image post style={mark=triangle},
  grid style={white},
  xlabel={Epochs},
ylabel={RMSE},
   y tick label style={
    /pgf/number format/.cd,
    fixed,
    fixed zerofill,
    precision=4
 },
  ]
    \addplot[blue] coordinates
      {(100,0.9245) (200,0.9247) (300,0.9243) (400,0.9244) (500,0.9246)(750,0.9253) (1000,0.9248)};
      \addlegendentry{Test}

%     \addplot[no marks,dotted,red] coordinates
%      {(100,0.6949) (200,0.7114) (300,0.7130) (400,0.7134) (500,0.7135 )(750,0.7134) (1000,0.7135)}; 
%      \addlegendentry{Error de entrenamiento}


    \addplot[brown] coordinates
     {(100,0.8814) (200,0.8836) (300,0.8847) (400,0.8855) (500,0.8857)(750,0.8862) (1000,0.8863)};
     \addlegendentry{Test} 

%      \addplot[black,dotted] coordinates
%     {(100,0.7285) (200,0.7564) (300,0.7671) (400,0.7721) (500,0.7745)(750,0.7766) (1000,0.7770)};
%     \addlegendentry{Error de entrenamiento}
  \end{axis}
\end{tikzpicture}
\end{document}

附言:我想在 y 轴上绘制精确的值。我以为这样precision=4可以,但实际上不行。

答案1

这就是你所追求的吗?

\documentclass[border=10pt]{standalone}

\usepackage{tikz}
\usepackage{pgfplots}\pgfplotsset{compat=1.9}


%%%>
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
  \begin{axis}[ 
  width=\linewidth,
  line width=0.5,
  grid=major, % Display a grid
  tick label style={font=\normalsize},
  legend style={nodes={scale=0.4, transform shape}},
  label style={font=\normalsize},
  legend image post style={mark=triangle},
  grid style={white},
  xlabel={Epochs},
ylabel={RMSE},
   y tick label style={
    /pgf/number format/.cd,
    fixed,
    fixed zerofill,
    precision=4
 },
legend style={at={(1,1)}, anchor=north east,  draw=none, fill=none},
ymin = 0,
ymax = 1.4,
  ]
    \addplot[blue] coordinates
      {(100,0.9245) (200,0.9247) (300,0.9243) (400,0.9244) (500,0.9246)(750,0.9253) (1000,0.9248)};
      \addlegendentry{Test}

%     \addplot[no marks,dotted,red] coordinates
%      {(100,0.6949) (200,0.7114) (300,0.7130) (400,0.7134) (500,0.7135 )(750,0.7134) (1000,0.7135)}; 
%      \addlegendentry{Error de entrenamiento}


    \addplot[brown] coordinates
     {(100,0.8814) (200,0.8836) (300,0.8847) (400,0.8855) (500,0.8857)(750,0.8862) (1000,0.8863)};
     \addlegendentry{Test} 

%      \addplot[black,dotted] coordinates
%     {(100,0.7285) (200,0.7564) (300,0.7671) (400,0.7721) (500,0.7745)(750,0.7766) (1000,0.7770)};
%     \addlegendentry{Error de entrenamiento}
  \end{axis}
\end{tikzpicture}
\end{document}

要得到:

在此处输入图片描述

根据您的输入坐标,这就是您的渲染输出。

相关内容