Rotating: Sideways figure with Section title

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?).

• What about either using a normal figure environment and just rotate the picture by enclosing the tikzpicture environment in \rotatebox{90}{...picture...}, or if you want to rotate the caption as well, using the solution here? – Thruston Nov 13 '13 at 18:17

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}

• that feels like a dirt hack, but i worked and i was able to combine a rotated picture+caption with a section in one page, so ...yeaah. – Sebastian Schmitz Sep 7 '14 at 17:06