\definecolor{ublue}{rgb}{0.152,0.250,0.545} \begin{tikzpicture} \begin{axis}[ width=12cm, height=4.5cm, symbolic x coords={未抽取词,do,want,what,am,people,look}, xtick=data, ytick={0,0.05,0.1,0.15,0.2,0.25}, xlabel={低概率词汇}, ylabel={词汇概率}, legend pos=outer north east, xlabel style={align=right,xshift=6.5cm,yshift=0.8cm,font=\footnotesize}, ylabel style={rotate=-90,yshift=2cm,xshift=1cm,font=\footnotesize}, y tick style={opacity=0}, x tick style={opacity=0}, x tick label style={anchor=base,font=\footnotesize,yshift=-0.5cm}, y tick label style={font=\footnotesize,/pgf/number format/.cd,fixed,precision=2}, y axis line style={opacity=0}, tick align=inside, ymajorgrids, axis x line*=bottom, major grid style={dotted,draw=ublue}, axis on top, legend style={anchor=north west,font=\footnotesize}, ymin=0, ymax=0.25] \addplot [ybar,bar shift=-2mm,bar width=4mm,fill=blue!40,draw=blue!40,area legend] coordinates{(未抽取词,0) (do,0.05) (want,0.05) (what,0.05) (am,0.1) (people,0.15) (look,0.2)}; \addplot [ybar,bar shift=2.15mm,bar width=4mm,fill=red!40,draw=red!40,area legend] coordinates{(未抽取词,0.03) (do,0.062) (want,0.062) (what,0.062) (am,0.09) (people,0.122) (look,0.138)}; \legend{未平滑,平滑后} \end{axis} \end{tikzpicture} %---------------------------------------------------------------------