0

I want to centre my figure under a heading both horizontally and vertically. I have currently done the horizontal centring via \centering and via the optional argument [h] the image appears under the heading. There should be nothing else on the page except the image. The following is a small example of what I mean:

\documentclass[final, english]{scrreprt}
\usepackage{tikz,pgfplots}
    \pgfplotsset{compat=newest}

\begin{document}

\section*{Heading}

\begin{figure}[h]
\centering
\begin{tikzpicture} 
    \draw[->, thick] (0,0) -- (5,0) node[below=0.2] {x};
    \draw[->, thick] (0,0) -- (0,5) node[below left=0.3] {y};
\end{tikzpicture}
\end{figure}

\end{document}

Is there a possibility to adjust the vertical alignment via optional arguments or how could this be set? Thank you in advance!

3
  • You can try the float option [p] instead of [h].
    – Alan Xiang
    May 31, 2021 at 13:49
  • Unfortunately the option [p] doesn't work
    – Lina
    May 31, 2021 at 14:50
  • try \vfill as shown in the answer below
    – js bibra
    May 31, 2021 at 16:17

1 Answer 1

1

enter image description here

\documentclass[final, english]{scrreprt}
\usepackage{tikz,pgfplots}
    \pgfplotsset{compat=newest}

\begin{document}

\section*{Heading}
\vfill
\begin{figure}[h]
\centering
\begin{tikzpicture} 
    \draw[->, thick] (0,0) -- (5,0) node[below=0.2] {x};
    \draw[->, thick] (0,0) -- (0,5) node[below left=0.3] {y};
\end{tikzpicture}
\end{figure}
\vfill
\end{document}
1
  • Thanks a lot! That works very well!
    – Lina
    May 31, 2021 at 17:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .