This question was asked already here but not answered completely. I know of two approaches but they do not apply to my problem:
ytick=data: In my example some of the tick labels will overlap.ytick={1000,...,6000}: Defining explicit ticks will cause problems when the data of each plot does not lie within the same range.
So my idea would be somelike the following:
ytick=NumOfTicks, whereas NumOfTicks can be any integer (e.g. ytick=5 would generate five ticks for every nextgrouplot).
Also interesting (but not applicable to my example) would be to write a macro which allows the following:
ytick={tickMin,tickMax,tJump}, whereas tJump can be any number (e.g. ytick={0,10000,2.5} would generate ticks starting at 0 and ending at 10000 with a space of 2.5 between each tick)
Note
Changing the groupplot-argument footnotesize to any other size (e.g. small) also has an impact on the number of ticks when you leave the determination of the number of ticks to LaTeX.
Consider the following MWE:
\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots,pgfplotstable}
\usetikzlibrary{pgfplots.groupplots}
\begin{document}
\begin{tikzpicture}
\begin{groupplot}[
group style={
group name=my plots,
group size=2 by 2,
xlabels at=edge bottom,
ylabels at=edge left,
vertical sep= 1.5cm,
horizontal sep= 2cm,
% every axis y label/.style={at={(ticklabel cs:0.5)},rotate=90,anchor=near ticklabel}
},
footnotesize,%changing footnotesize to small will affect the number of ticks
width=5cm,
height=5cm,
%
xlabel=xlabel,
ylabel=very long label
% ,ytick=data
]
\nextgroupplot[title=\#1]
\addplot coordinates{(42, 255) (43, 1584) (44, 1296) (45, 432) (46, 972) (47, 540) (48, 1104) (49, 0)};
\nextgroupplot[title=\#2]
\addplot coordinates{(42, 400) (43, 400) (44, 0) (45, 400) (46, 0) (47, 0) (48, 0) (49, 0)};
\nextgroupplot[title=\#3]
\addplot coordinates{(42, 1800) (43, 2100) (44, 1800) (45, 900) (46, 2100) (47, 2100) (48, 2100) (49, 0)};
\nextgroupplot[title=\#4]
\addplot coordinates{(42, 6800) (43, 2800) (44, 2800) (45, 2800) (46, 2000) (47, 2800) (48, 0) (49, 0)};
\end{groupplot}
\end{tikzpicture}
\end{document}

try min ticksandmax space between ticksfor the x and y parts? – bonanza Dec 13 '16 at 10:01