I have a following chart, and I am trying to decrease the distance between the x-axis ticks FCC and Beta pi. Any suggestions on how to reduce this?
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usetikzlibrary{decorations.pathmorphing}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
%legend columns=-1,
legend cell align=left,
every axis plot post/.style={/pgf/number format/fixed},
ybar=2pt,
bar width=10pt,
x=5cm,
y=4.5cm,
ymin=0,
axis on top,
%ymax=12,
xtick=data,
%xlabel=Cores,
ylabel=Peak Energy (E),
enlarge x limits=0.2,
%enlarge y limits={abs=0.5},
symbolic x coords={FCC,Beta pi},
%restrict y to domain*=0:11, % Cut values off at 14
visualization depends on=rawy\as\rawy, % Save the unclipped values
after end axis/.code={ % Draw line indicating break
\draw [ultra thick, white] (rel axis cs:0,1.05) -- (rel axis cs:1,1.05);
},
nodes near coords={\scriptsize{\pgfmathprintnumber{\rawy}}
},
axis lines*=left,
clip=false,
area legend
%legend style={at={(0.6,0.8)},anchor=west}
]
\addplot[fill=red!40] coordinates {(FCC,0.7) (Beta pi,0.66) };
\addplot[fill=yellow!40] coordinates {(FCC,1) (Beta pi,0.81) };
\addplot[fill=blue!40] coordinates {(FCC,0.6) (Beta pi,0.74)};
\addplot[fill=green!40] coordinates {(FCC,0.5) (Beta pi,0.7)};
\legend{x264,bodytrack,swaptions,blacksholes};
\end{axis}
\end{tikzpicture}
\end{document}
Best Answer
There are different ways of getting rid of that big empty space:
enlarge x limits
value. You can set this value in terms of axis units usingabs=1
if you have\pgfplotsset{compat=1.8}
or newer in your preamble.bar width
key. Note that you will also have to increase theenlarge x limits
value, and you might want to remove the space within the groups of bars by settingybar=0pt
.