I am working on a population pyramid. With some sort of hard-code I managed to overlap the ytick-labels of the age in the middle of the graph (but not properly). My question is, how to 1.) suppress the y-tick-labels of one of the axes and 2.) align the y-tick label of the left od rigth y-axis to avoid the overlap of the numbers.
Has someone an idea? Thanky for the help,
Cheers, Christian
Although it isn't a minimal example, I post the whole thing:
\documentclass{article}
\usepackage{longtable}
\usepackage{pgfplots}%\pgfplotsset{compat=1.10}
\usepackage{pgfplotstable}
\usepackage{lmodern}
\usepackage{wasysym}
\begin{document}
\pgfplotstableread[col sep=comma, header=true]{
age,man,woman
0,30,32
1,40,42
2,30,32
3,36,32
4,33,25
5,34,35
6,26,28
7,16,22
8,30,38
9,21,32
10,22,24
11,29,27
12,32,28
13,29,15
14,28,23
15,17,25
16,23,17
17,26,25
18,20,22
19,11,22
20,26,25
21,19,19
22,18,22
23,18,24
24,14,25
25,9,18
26,15,14
27,14,10
28,20,12
29,14,13
30,15,13
31,13,18
32,15,15
33,14,16
34,11,12
35,8,10
36,13,11
37,9,7
38,5,18
39,12,12
40,8,6
41,11,9
42,8,10
43,6,8
44,9,6
45,7,8
46,10,10
47,3,8
48,11,8
49,11,8
50,9,6
51,3,10
52,6,11
53,6,5
54,6,8
55,5,6
56,5,8
57,8,4
58,10,4
59,4,8
60,7,3
61,3,8
62,6,3
63,4,3
64,6,3
65,3,4
66,6,3
67,2,5
68,4,3
69,5,8
70,5,3
71,5,5
72,6,3
73,4,0
74,5,4
75,7,3
76,0,0
77,2,2
78,2,1
79,4,3
80,2,0
81,0,1
82,2,2
83,0,1
84,2,0
85,1,0
86,0,1
87,0,1
88,0,0
89,0,1
90,1,0
91,0,0
92,0,0
93,1,0
94,0,1
}\loadedtable
\begin{tikzpicture}
%FRAUEN-ACHSE
\begin{axis}[
name=popaxis, xshift=0.42239cm,
scale only axis,
set layers,
xtick style={/pgfplots/on layer=axis foreground, very thin, black},
xbar,
xmin=0,
xmax=40,
ymin=0,
width=0.5\textwidth, height=0.9\textwidth,
%x label style={at={(axis description cs:0.7,-0.05)},anchor=north},
xlabel ={\large{Frauen}},
axis x line=left,
axis y line=left,
ytick = {10,20,...,100},
ytick align=center,
ytick style={/pgfplots/on layer=axis foreground, very thin, black},
yticklabel style={/pgfplots/on layer=axis foreground},
major grid style={/pgfplots/on layer=axis background},
xmajorgrids,
%
enlarge x limits = {value=0.15,upper},
axis line style={-},
clip=false,
axis on top
]
\addplot[xbar interval][red,fill=red] table[y expr =\coordindex, x expr={\thisrow{woman}}] \loadedtable;%[xbar intervall]
%
\end{axis}
%MÄNNER_ACHSE
\begin{axis}[
at={(popaxis.south west)},anchor=south east, xshift=-0.42239cm,
scale only axis,
set layers,
xtick style={/pgfplots/on layer=axis foreground, very thin, black},
xbar = 0,
xmin = 0,
xmax = 40,
ymin=0,
width=0.5\textwidth, height=0.9\textwidth,
%x label style={at={(axis description cs:0.7,-0.05)},anchor=north},
xlabel = {\large{M\"{a}nner}},
axis x line=left,
axis y line=left,
x dir=reverse,
%
ytick = {10,20,...,100},
ytick align=center,
ytick pos=right, %gibt an, ob die Ordinate links od. rechts ist
ytick style={/pgfplots/on layer=axis foreground, very thin, black},
yticklabel style={/pgfplots/on layer=axis foreground},
%ylabel = {\large{Anzahl der Personen}},
%y label style={at={(axis description cs:0.87,-0.1)},anchor=north west, rotate=270},
%
enlarge x limits = {value=0.15,upper},
axis line style={-},
major grid style={/pgfplots/on layer=axis background},
xmajorgrids,
axis on top
]
\addplot[xbar interval][blue!100,fill=blue!100] table[y expr =\coordindex, x expr={\thisrow{man}}] \loadedtable;
\end{axis}
\end{tikzpicture}
\end{document}

yticktoytick =\empty– Salim Bou Jul 15 '15 at 20:14yticklabels={,,}, take a look to this answer – Salim Bou Jul 15 '15 at 20:28xshift=1mm(or what satisfy you) to the keyyticklabel style– Salim Bou Jul 15 '15 at 20:47