I currently used tikzplotlib from Python to generate the following plot in LaTeX. However, my current subplots are overlapping in LaTeX while they were not overlapping in Python (I used fig.tight_layout() which I think was not exported in tikzplotlib). I was wondering if you guys know how to adjust the following code so that my title does not overlap with the x-axes from the graph above and the y-axes of the right plots overlaps with the plot of the left plots. Finally, I do want to keep the plot inbetween the width and heigth of the page.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\begin{document}
\begin{tikzpicture}
\definecolor{darkgray176}{RGB}{176,176,176}
\definecolor{steelblue31119180}{RGB}{31,119,180}
\begin{groupplot}[group style={group size=2 by 3}]
\nextgroupplot[
tick align=outside,
tick pos=left,
title={OLS},
x grid style={darkgray176},
xmin=0, xmax=0.525,
xtick style={color=black},
y dir=reverse,
y grid style={darkgray176},
ymin=-0.69, ymax=5.69,
ytick style={color=black},
ytick={0,1,2,3,4,5},
yticklabels={check,mom1m,indmom,2,3,4}
]
\draw[draw=none,fill=steelblue31119180] (axis cs:0,-0.4) rectangle (axis cs:0.33,0.4);
\draw[draw=none,fill=steelblue31119180] (axis cs:0,0.6) rectangle (axis cs:0.5,1.4);
\draw[draw=none,fill=steelblue31119180] (axis cs:0,1.6) rectangle (axis cs:0.17,2.4);
\draw[draw=none,fill=steelblue31119180] (axis cs:0,2.6) rectangle (axis cs:0.12,3.4);
\draw[draw=none,fill=steelblue31119180] (axis cs:0,3.6) rectangle (axis cs:0.08,4.4);
\draw[draw=none,fill=steelblue31119180] (axis cs:0,4.6) rectangle (axis cs:0.1,5.4);
\nextgroupplot[
tick align=outside,
tick pos=left,
title={ENet + H},
x grid style={darkgray176},
xmin=0, xmax=0.525,
xtick style={color=black},
y dir=reverse,
y grid style={darkgray176},
ymin=-0.69, ymax=5.69,
ytick style={color=black},
ytick={0,1,2,3,4,5},
yticklabels={check,mom1m,indmom,2,3,4}
]
\draw[draw=none,fill=steelblue31119180] (axis cs:0,-0.4) rectangle (axis cs:0.33,0.4);
\draw[draw=none,fill=steelblue31119180] (axis cs:0,0.6) rectangle (axis cs:0.5,1.4);
\draw[draw=none,fill=steelblue31119180] (axis cs:0,1.6) rectangle (axis cs:0.17,2.4);
\draw[draw=none,fill=steelblue31119180] (axis cs:0,2.6) rectangle (axis cs:0.12,3.4);
\draw[draw=none,fill=steelblue31119180] (axis cs:0,3.6) rectangle (axis cs:0.08,4.4);
\draw[draw=none,fill=steelblue31119180] (axis cs:0,4.6) rectangle (axis cs:0.1,5.4);
\nextgroupplot[
tick align=outside,
tick pos=left,
title={PCR},
x grid style={darkgray176},
xmin=0, xmax=0.525,
xtick style={color=black},
y dir=reverse,
y grid style={darkgray176},
ymin=-0.69, ymax=5.69,
ytick style={color=black},
ytick={0,1,2,3,4,5},
yticklabels={check,mom1m,indmom,2,3,4}
]
\draw[draw=none,fill=steelblue31119180] (axis cs:0,-0.4) rectangle (axis cs:0.33,0.4);
\draw[draw=none,fill=steelblue31119180] (axis cs:0,0.6) rectangle (axis cs:0.5,1.4);
\draw[draw=none,fill=steelblue31119180] (axis cs:0,1.6) rectangle (axis cs:0.17,2.4);
\draw[draw=none,fill=steelblue31119180] (axis cs:0,2.6) rectangle (axis cs:0.12,3.4);
\draw[draw=none,fill=steelblue31119180] (axis cs:0,3.6) rectangle (axis cs:0.08,4.4);
\draw[draw=none,fill=steelblue31119180] (axis cs:0,4.6) rectangle (axis cs:0.1,5.4);
\nextgroupplot[
tick align=outside,
tick pos=left,
title={PLS},
x grid style={darkgray176},
xmin=0, xmax=0.525,
xtick style={color=black},
y dir=reverse,
y grid style={darkgray176},
ymin=-0.69, ymax=5.69,
ytick style={color=black},
ytick={0,1,2,3,4,5},
yticklabels={check,mom1m,indmom,2,3,4}
]
\draw[draw=none,fill=steelblue31119180] (axis cs:0,-0.4) rectangle (axis cs:0.33,0.4);
\draw[draw=none,fill=steelblue31119180] (axis cs:0,0.6) rectangle (axis cs:0.5,1.4);
\draw[draw=none,fill=steelblue31119180] (axis cs:0,1.6) rectangle (axis cs:0.17,2.4);
\draw[draw=none,fill=steelblue31119180] (axis cs:0,2.6) rectangle (axis cs:0.12,3.4);
\draw[draw=none,fill=steelblue31119180] (axis cs:0,3.6) rectangle (axis cs:0.08,4.4);
\draw[draw=none,fill=steelblue31119180] (axis cs:0,4.6) rectangle (axis cs:0.1,5.4);
\nextgroupplot[
tick align=outside,
tick pos=left,
title={RF},
x grid style={darkgray176},
xmin=0, xmax=0.525,
xtick style={color=black},
y dir=reverse,
y grid style={darkgray176},
ymin=-0.69, ymax=5.69,
ytick style={color=black},
ytick={0,1,2,3,4,5},
yticklabels={check,mom1m,indmom,2,3,4}
]
\draw[draw=none,fill=steelblue31119180] (axis cs:0,-0.4) rectangle (axis cs:0.33,0.4);
\draw[draw=none,fill=steelblue31119180] (axis cs:0,0.6) rectangle (axis cs:0.5,1.4);
\draw[draw=none,fill=steelblue31119180] (axis cs:0,1.6) rectangle (axis cs:0.17,2.4);
\draw[draw=none,fill=steelblue31119180] (axis cs:0,2.6) rectangle (axis cs:0.12,3.4);
\draw[draw=none,fill=steelblue31119180] (axis cs:0,3.6) rectangle (axis cs:0.08,4.4);
\draw[draw=none,fill=steelblue31119180] (axis cs:0,4.6) rectangle (axis cs:0.1,5.4);
\nextgroupplot[
tick align=outside,
tick pos=left,
title={GBRT},
x grid style={darkgray176},
xmin=0, xmax=0.525,
xtick style={color=black},
y dir=reverse,
y grid style={darkgray176},
ymin=-0.69, ymax=5.69,
ytick style={color=black},
ytick={0,1,2,3,4,5},
yticklabels={check,mom1m,indmom,2,3,4}
]
\draw[draw=none,fill=steelblue31119180] (axis cs:0,-0.4) rectangle (axis cs:0.33,0.4);
\draw[draw=none,fill=steelblue31119180] (axis cs:0,0.6) rectangle (axis cs:0.5,1.4);
\draw[draw=none,fill=steelblue31119180] (axis cs:0,1.6) rectangle (axis cs:0.17,2.4);
\draw[draw=none,fill=steelblue31119180] (axis cs:0,2.6) rectangle (axis cs:0.12,3.4);
\draw[draw=none,fill=steelblue31119180] (axis cs:0,3.6) rectangle (axis cs:0.08,4.4);
\draw[draw=none,fill=steelblue31119180] (axis cs:0,4.6) rectangle (axis cs:0.1,5.4);
\end{groupplot}
\end{tikzpicture}
\end{document}
group/horizontal sep=2cm, group/vertical sep=2cm
(as option togroupplot
) to increase the distance between the subplots. But you will probably need to adjust their size as well.