i've successfully created my first 'bar chart' today:

by the use of the code given below:
\documentclass[tikz,border=1pt]{standalone}
\usepackage[ngerman]{babel}
\usepackage[ansinew]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{pgfplots}
\usepackage{amsmath}
\usepackage{units}
\usetikzlibrary{matrix}
\pgfplotsset{compat=1.10,
saeule-style/.style={
title={\textbf{Bar Chart}},
},
height=6cm,
width=20cm,
grid=major,
grid style={
solid,
ultra thin,
gray
},
xmin=1925,
xmax=1975,
xtick={1925,1930,...,1975},
x tick label style={
rotate=90
},
x tick style={
color=black,
thin
},
ymin=0,
ymax=10,
y tick style={
color=black,
thin
},
xlabel={\textbf{Year}},
ylabel={\textbf{Population}},
legend columns=2,
legend style={
font=\scriptsize,
legend pos=north west,
draw=none,
/tikz/column 2/.style={
column sep=10pt,
}
},
ybar=5pt,
nodes near coords,
/pgf/number format/.cd,
use comma,
set thousands separator={},
}
\begin{document}
\begin{tikzpicture}
\begin{axis}[saeule-style]
\addplot[ybar, bar width=0.2cm, fill=blue, draw=black] coordinates {(1930,5) (1940,3) (1950,4) (1960,5) (1970,7)};
\addplot[ybar, bar width=0.2cm, fill=red, draw=black] coordinates {(1930,3) (1940,4) (1950,4) (1960,4) (1970,6)};
\legend{Far,Near}
\end{axis}
\end{tikzpicture}
\end{document}
As you can see, I added those x- and ytics. As I expected, the ytics were drawn in the diagram. Unfortunately, the xtics don't. It seems that something gave them a kind of "outer"-option.
Does anyone of you know how I can place them also in the diagram?
Thank you in advance, eniem
EDIT: Hmm ... now tried to use the 'xtick align=inside'-option, but it doesn't work. Does anybody know why?
\documentclass[tikz,border=1pt]{standalone}
\usepackage[ngerman]{babel}
\usepackage[ansinew]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{pgfplots}
\usepackage{amsmath}
\usepackage{units}
\pgfplotsset{compat=newest,
saeule-style/.style={
title={\textbf{Bar Chart}},
},
height=6cm,
width=20cm,
grid=major,
grid style={
solid,
ultra thin,
gray
},
xmin=1925,
xmax=1975,
xtick={1925,1930,...,1975},
xtick align=inside,
xticklabel style={
rotate=90
},
xtick style={
color=black,
thin
},
ymin=0,
ymax=10,
ytick align=inside,
y tick style={
color=black,
thin
},
xlabel={\textbf{Year}},
ylabel={\textbf{Population}},
legend columns=2,
legend style={
font=\scriptsize,
legend pos=north west,
draw=none,
/tikz/column 2/.style={
column sep=10pt,
}
},
ybar=5pt,
/pgf/number format/.cd,
use comma,
set thousands separator={},
}
\begin{document}
\begin{tikzpicture}
\begin{axis}[saeule-style]
\addplot[ybar, bar width=6pt, fill=blue, draw=black] coordinates {(1930,5) (1940,3) (1950,4) (1960,5) (1970,7)};
\addlegendentry{Far}
\addplot[ybar, bar width=6pt, fill=red, draw=black] coordinates {(1930,3) (1940,4) (1950,4) (1960,4) (1970,6)};
\addlegendentry{Near}
\end{axis}
\end{tikzpicture}
\end{document}
Thank you in advance! eniem

xtick align=inside, of course=)– Jake Aug 18 '14 at 16:41xtick align=insidelike I added in my first question above. Unfortunately it doesn't work. And I don't know why. Maybe you could help me ... – eniem Aug 19 '14 at 09:29ybar=5pt? – percusse Aug 19 '14 at 09:31xtick align=insideafterybar=5pt, since theybaroption calls (among other things)xtick align=outside, which overwrites the previousxtick alignoption. – Jake Aug 19 '14 at 09:48