绘制图表和图表线?

绘制图表和图表线?

如何在 Latex {revtex4-1} 中绘制这条曲线?

\begin{center}
\begin{tikzpicture}
\begin{axis}[bar width=18pt,
 xtick=data,ymin=0,ymax=45,x tick label style=
{rotate=90,anchor=east}]
\addplot[ybar] coordinates{ (126.5  ,2 ) (134.5 ,4 ) (142.5 ,13) (150.5 ,20) (158.5 ,35) (166.5 ,33) (174.5 ,25) (182.5 ,17) (190.5 ,5 ) (198.5 ,3 )  };
\addplot +[smooth,black,mark = *,mark options={solid,black}]coordinates{ (126.5,    1.3 ) (134.5,   4.3 ) (142.5,   11.2) (150.5,   22.6) (158.5,   31.2) (166.5,   33.5) (174.5,   26.9) (182.5,   16.2) (190.5,   7.2 ) (198.5,   2.4 )};

在此处输入图片描述

答案1

要获得所需的格式,您可以应用:

  • draw=red, pattern=north west lines, pattern color=red提供条形图的填充图案
  • marks=none消除点
  • /pgf/number format/fixed/pgf/number format/precision=0控制的显示x ticks labels,和
  • ylabel={Count} andxlabel={Time}` 标记轴

在此处输入图片描述

代码:

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\usetikzlibrary{patterns}


\begin{document}
\noindent
\begin{tikzpicture}
\begin{axis}[bar width=18pt,
     xtick=data,ymin=0,ymax=45,
     x tick label style={
         rotate=90,
         anchor=east,
         /pgf/number format/fixed,
         /pgf/number format/precision=0,
         },
         ylabel={Count},
         xlabel={Time},
 ]
\addplot[ybar, draw=red, thick, pattern=north west lines, pattern color=red] coordinates{ (126.5  ,2 ) (134.5 ,4 ) (142.5 ,13) (150.5 ,20) (158.5 ,35) (166.5 ,33) (174.5 ,25) (182.5 ,17) (190.5 ,5 ) (198.5 ,3 )  };
\addplot +[smooth,black,mark=none, thick] coordinates{ (126.5,    1.3 ) (134.5,   4.3 ) (142.5,   11.2) (150.5,   22.6) (158.5,   31.2) (166.5,   33.5) (174.5,   26.9) (182.5,   16.2) (190.5,   7.2 ) (198.5,   2.4 )};
\end{axis}
\end{tikzpicture}

\end{document}

相关内容