I have these four tikspicture plots as subfigures. I want to have the axes aligned as well as the subcaptions (a,b,c,d). Also, I want the plots to have the same size and the subcaption letters to be centered underneath each plot. Another problem seems to be that the plots are to close to the margin on the right-hand side.
Thank you very much for any help!
\documentclass[
12pt,
a4paper,
parskip=half,
toc=bibliography,
numbers=noendperiod
]{scrbook}
\usepackage[
left=3cm,
right=2.5cm,
top=2.5cm,
bottom=2.0cm,
includehead,
includefoot
]{geometry}
\usepackage[UKenglish]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{scrlayer-scrpage}
\usepackage{lmodern}
\usepackage{textcomp}
\usepackage{amsmath,amssymb}
\usepackage{mwe}
\usepackage{esvect}
\usepackage{mathfixs}
\usepackage[right]{eurosym}
\usepackage{gensymb}
\usepackage[dvipsnames,table,xcdraw]{xcolor}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{float}
\usepackage{caption}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\addtokomafont{caption}{\scriptsize}
\usepackage[font={normal}]{caption}
\setkomafont{captionlabel}{\bfseries\rmfamily}
\begin{document}
\begin{figure}[H]
\begin{subfigure}{0.4\linewidth}
\begin{tikzpicture}[baseline]
\begin{axis}[
xticklabels={one, two, three, four, five},
tick label style={font=\scriptsize},
x tick label style = {rotate=45, anchor=east},
ylabel={Flux},
ymin=-0.05,
ymax=20,
xtick={1,2,3,4,5},
]
\addplot[color=Blue, mark=*, dashed]
coordinates {(1,-0.03)(2,4.55)(3,2.55)(4,1.06)(5,16.91)};
\end{axis}
\end{tikzpicture}
\caption{ }
\end{subfigure}
\hfill
\begin{subfigure}{0.4\linewidth}
\begin{tikzpicture}
\begin{axis}[
xticklabels={one, four, five, twenty, thirty},
tick label style={font=\scriptsize},
x tick label style = {rotate=45, anchor=east},
ylabel={Flux},
ymin=0,
xtick={1,2,3,4,5},
legend pos=outer north east,
legend cell align={left}
]
\addplot[color=Blue, mark=*, dashed]
coordinates {(1,0.00)(2,47.77)(3,1.10)(4,14.68)(5,5.53)};
\end{axis}
\end{tikzpicture}
\caption{ }
\end{subfigure}
\vfill
\begin{subfigure}{0.4\linewidth}
\begin{tikzpicture}
\begin{axis}[
xticklabels={one, nine, seven, thirteen},
tick label style={font=\scriptsize},
x tick label style = {rotate=45, anchor=east},
ylabel={Flux},
ymin=0,
xtick={1,2,3,4},
legend pos=outer north east,
legend cell align={left}
]
\addplot[color=Blue, mark=*, dashed]
coordinates {(1,0.78)(2,6.72)(3,4.25)(4,7.97)};
\end{axis}
\end{tikzpicture}
\caption{ }
\end{subfigure}
\hfill
\begin{subfigure}{0.4\linewidth}
\begin{tikzpicture}
\begin{axis}[
xticklabels={one, two},
tick label style={font=\scriptsize},
x tick label style = {rotate=45, anchor=east},
ylabel={Flux},
ymin=-1,
ymax=1,
xtick={1,2},
legend pos=outer north east,
legend cell align={left}
]
\addplot[color=Blue, mark=*, dashed]
coordinates {(1,0.00)(2,-0.02)};
\end{axis}
\end{tikzpicture}
\caption{ }
\end{subfigure}
\caption{caption for all plots}
\label{all_plots}
\end{figure}
\end{document}


Relatedsection where sometimes you could find answers or at least leads to an answer. For example, in this case, you have (https://tex.stackexchange.com/questions/191160/how-can-i-align-2-plots-vertically?rq=1) and (https://tex.stackexchange.com/questions/191865/aligning-multiple-figures-tikzpicture-vertically-and-horizontally?rq=1). – SebGlav Jul 25 '23 at 17:11