1

If possible I want to draw following simple histogram, where there is no much gap in between.

enter image description here

When I try (original code is taken from: PGFPlots histogram not showing all series):

\documentclass{article}
\usepackage{siunitx}
\usepackage{pgfplots}

\pgfplotsset{compat=1.12}

\sisetup{ round-mode = places, round-precision = 2, }

\begin{document} \begin{tikzpicture} \begin{axis}[ x tick label style={ /pgf/number format/1000 sep=}, ylabel={\small{Efficienza (\milli\gram\per\gram)}}, width = 15.4cm, height = 10.7cm, legend style={ font=\scriptsize, cells={anchor=west} }, legend pos=north west, symbolic x coords={Spugna 1,Spugna 2}, xtick=data, tick label style={font=\scriptsize}, ybar, bar width = .8cm ] \addplot coordinates {(Spugna 1,0.56) (Spugna 2,2.84) }; \addplot coordinates {(Spugna 1,0.66) (Spugna 2,3.10) }; \legend{Reali,Fitting} \end{axis} \end{tikzpicture} \end{document}

I get following output:

enter image description here


The histogram looks nicely when it has multiple comparing labels like https://tex.stackexchange.com/a/82373/127048.

But if there is two-three compared histograms, there is a huge gap in between like I am having. How can I remove the gap in between and make it look more compact.

alper
  • 1,389
  • 2
    You can try enlarge x limits=0.5 or something similar. Unrelated: You should get an error which can be solved by replacing \milli\gram\per\gram by \unit{\milli\gram\per\gram}. – Jasper Habicht Jun 02 '23 at 12:57
  • @JasperHabicht enlarge x limits=0.8 and also using width = 6cm help me to solve it. – alper Jun 04 '23 at 09:52

0 Answers0