# PGFPlot formatting help

I have the following pgfplot:

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{every axis legend/.append style={
at={(1.05,1)},
anchor=north west}}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
ylabel=Number of Respondents,
enlargelimits=0.15,
legend cell align=right,
ybar,
bar width=10pt,
symbolic x coords = {Very U, Somewhat U, Not U},
xtick=data,
x tick label style={anchor=north},
width=.50\textwidth,
ymin=0,
]
coordinates {(Very U,1) (Somewhat U,3) (Not U,1)};
coordinates {(Very U,2) (Somewhat U,0) (Not U,0)};
coordinates {(Very U,1) (Somewhat U,2) (Not U,0)};
coordinates {(Very U,4) (Somewhat U,5) (Not U,1)};
\legend{Survey Vote \#257, Survey Vote \#968, Survey Vote \#156, All Surveys}
\end{axis}
\end{tikzpicture}
\end{document}


What I want to do, is have the leftmost group have a little padding before it starts (not right up on the y axis) and the same for the rightmost group, have a little padding between it and the y axis.

I would also like to make the legend just a bit bigger...

-
Hi Lisa, welcome to TeX.sx! Would you mind editing your question title to something more descriptive (like "Padding on left and right edge of ybar plot")? Also, there should only be one question per post, as that makes it easier for others to find the information. – Jake Jul 15 '12 at 8:18

To get extra padding on the left and right side of the plot, you can set enlarge x limits=<fraction>. 0.3 works well in this case, but it leads to the bars in the middle of the plot overlapping, so you'll have to reduce the bar width a bit, say, to 6pt.

enlarge x limits=0.3,
bar width=6pt


As you can see, since your x labels are quite long, they overlap, so it looks like you'll have to make the plot wider. You can do that either by explicitly setting both a height and a width, or by using the key x post scale=<multiplier>.

enlarge x limits=0.3,
x post scale=1.5


To make the legend images larger, you can use legend image post style={scale=<multiplier>}:

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{every axis legend/.append style={
at={(1.05,1)},
anchor=north west},
legend image post style={scale=1.5}
}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
ylabel=Number of Respondents,
enlarge x limits=0.3,
x post scale=1.5,
legend cell align=right,
ybar,
symbolic x coords = {Very U, Somewhat U, Not U},
xtick=data,
x tick label style={anchor=north},
width=.50\textwidth,
ymin=0,
]
coordinates {(Very U,1) (Somewhat U,3) (Not U,1)};