[Tex/LaTex] Rotating: Sideways figure with Section title

floatsrotating

Is there any way I can fit a sideways figure using the rotating package onto the same page as the title of the section?

\documentclass[a4paper,12pt]{article} 
\usepackage[applemac]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}

\usepackage{graphicx}
\usepackage{rotating}
\usepackage{tikz}

\begin{document}

\subsection{My sideways figure}

\begin{sidewaysfigure}[h!]
\centering
\begin{tikzpicture}[scale=4]
    \fill[blue] (0,0) rectangle(2,1.5);  
\end{tikzpicture}
\caption{Box plot of number of positions sent per iteration using this scheme}
\label{fig:awesome_image}
\end{sidewaysfigure}

\end{document}

P.S. Credit to @Jubobs for his example of how to use the rotatingpackage (how to turn latex figure by 90 degrees along with the caption?).

Best Answer

An elemental approach with two turn environments and minipages. The result is the same with or without the added Lore ipsum dummy text.

\documentclass[a4paper,12pt]{article} 
\usepackage[applemac]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{rotating}
\usepackage{lipsum}
\usepackage{tikz}

\begin{document}

\subsection{My sideways figure}
\lipsum[2]
\begin{figure}[h!]
\centering
\begin{minipage}[b][8cm][b]{6cm}
\begin{turn}{90}
\begin{tikzpicture}[scale=4]
    \fill[blue] (0,0) rectangle(2,1.5);  
\end{tikzpicture}
\end{turn}
\end{minipage}
\begin{turn}{90}
\begin{minipage}[c][1cm][c]{8cm}
\caption{Box plot of number of positions sent per iteration using this scheme.}
\label{fig:awesome_image}
\end{minipage} 
\end{turn}
\end{figure}
\lipsum[1]

\end{document}