The bar plot produced by the following code has two issues:
1) It is cropped at the extreme left and right edges
2) There is too much space between the two groups of bars.
Code: Select all
Code, edit and compile here:
\documentclass{standalone}\usepackage{pgfplots}\pgfplotsset{compat=1.17}\begin{document}\begin{tikzpicture}\begin{axis}[ybar,symbolic x coords={Overall,Specific},xtick=data,yticklabel={\pgfmathprintnumber{\tick}\%},ymin=0,ymax=100,ymajorgrids=true,]\addplot coordinates {(Overall,45) (Specific,70)};\addplot coordinates {(Overall,29) (Specific,16)};\addplot coordinates {(Overall,26) (Specific,15)};\legend{type1,type2,type3}\end{axis}\end{tikzpicture}\end{document}
enlargelimits
) just adds space below the ybars for my plot and the spacing/cropping issues remain.The equivalent to the second solution (setting
xmin
and xmax
with [normalized]
) indeed changes where the bars are placed , but the principle behind normalized
is not explained so I am left randomly guessing numbers to try and approximate an acceptable output.