如何在 pgfplots 中删除框架并保留轴标签?

如何在 pgfplots 中删除框架并保留轴标签?

我有一个简单的 pgfplots 图,取自PGFPlots 画廊

\begin{tikzpicture} 
    \begin{axis} 
        \addplot+[ybar] plot coordinates {(0,3) (1,2) (2,4) (3,1) (4,2)}; 
    \end{axis} 
\end{tikzpicture}

我想删除框架(垂直线、水平线和这些线中的虚线)但保留 xtick 和 ytick 标签。

我怎样才能做到这一点?

注意:我正在尝试制作这个图片这就是为什么我需要移除框架:

在此处输入图片描述

答案1

调整axis-options。您可以添加:

  axis line style={draw=none},
  tick style={draw=none}

第二个选项也删除了勾号。

答案2

像这样吗?

\documentclass[margin=2mm,tikz]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}

\begin{document}
\begin{tikzpicture} 
    \begin{axis}[
        axis line style={draw=none},
        tick style={draw=none},
        ylabel = {Exabytes\\ per month},
        ylabel style={align=center,rotate=-90},
    ]
        \addplot+[ybar] plot coordinates {(0,3) (1,2) (2,4) (3,1) (4,2)}; 
    \end{axis} 
\end{tikzpicture}
\end{document}

我还添加了带有换行符的 Y 轴标签。

结果:

结果

相关内容