TransWikia.com

Why is the first bar missing in my second plot in pgsplots when I set `axis lines=left`?

TeX - LaTeX Asked on February 27, 2021

I want to make some bar plots and when I do this, I only want the lower x and left y axis to be visible and hence I set pgfplotsset{axis lines=left}, but as soon as I do this, the first bar of my second plot is not visible anymore. Here is the MWE and I am curious what this is:

documentclass{standalone}

usepackage{pgfplots}
pgfplotsset{width=7cm,compat=1.15}

usetikzlibrary{arrows.meta}

pgfplotsset{axis lines=left}

begin{document}
    begin{tikzpicture}
    begin{axis}[ybar,xmin=-0.5,xmax=2.5,xtick={0,1,...,2},xticklabels={tool1, tool2, tool3},bar width=5pt]
    addplot coordinates{(0,10) (1,13) (2,8)};
    addplot coordinates{(0,3) (1,5) (2,9)};
    end{axis}
    end{tikzpicture}
end{document}

enter image description here

One Answer

It's visible, but the y-limits have changed, so you only see the top line of the bar. Add ymin=0 to the axis options.

Correct answer by Torbjørn T. on February 27, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP