Graphics, Figures & TablesArranging figures

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
nico
Posts: 20
Joined: Tue Jun 08, 2010 10:13 am

Arranging figures

Post by nico »

Hello,

I want to arrange 4 of my gnuplottex figures on a page. So I tried this minimal example:

Code: Select all

\documentclass[10pt,a4paper,captions=nooneline]{article}

\usepackage{gnuplottex}
\usepackage{lscape}
\usepackage[a4paper, portrait, left=2.5cm, right=3cm, top=2cm, bottom=2cm, includefoot, marginpar=2cm]{geometry}

\begin{document}

\begin{landscape}
\begin{figure}

	\begin{minipage}[t]{.4\textwidth}
		\begin{gnuplot}[terminal=pdf,scale=.8]
			plot  sin(x)
		\end{gnuplot}
	\end{minipage}
	%\hfill
	\begin{minipage}[t]{.4\textwidth}
		\begin{gnuplot}[terminal=pdf,scale=.8]
			plot  sin(x)
		\end{gnuplot}		
	\end{minipage}
	\\
	\begin{minipage}[t]{.4\textwidth}
		\begin{gnuplot}[terminal=pdf,scale=.8]
			plot  sin(x)
		\end{gnuplot}	
	\end{minipage}
	%\hfill
	\begin{minipage}[t]{.4\textwidth}
		\begin{gnuplot}[terminal=pdf,scale=.8]
			plot  sin(x)
		\end{gnuplot}	
	\end{minipage}
	
\end{figure}
\end{landscape}

\end{document}
But the figures are overlapping horizontally. When i use \hfill, the second figure is partially not on the page.

Could someone help me, please?
Attachments
tst.pdf
output of the minimal example
(36.04 KiB) Downloaded 339 times
Last edited by nico on Wed Sep 15, 2010 2:10 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Arranging figures

Post by localghost »

I suggest to use packages like floatrow or »subcaption« (shipped with caption) to arrange sub-figures. For a landscape figure that occupies a whole page I suggest the sidewaysfigure environment from the rotating package.


Thorsten
nico
Posts: 20
Joined: Tue Jun 08, 2010 10:13 am

Arranging figures

Post by nico »

Thank you, Thorsten! Unhappily I am not satisfied.

With sidewayfigure I got it working:

Code: Select all

\documentclass[10pt,a4paper,captions=nooneline]{article}

\usepackage{gnuplottex}
\usepackage{rotating}
\usepackage[a4paper, portrait, left=2.5cm, right=3cm, top=2cm, bottom=2cm, includefoot, marginpar=2cm]{geometry}

\begin{document}

\begin{sidewaysfigure}
	\begin{minipage}[t]{.4\textwidth}
		\begin{gnuplot}[terminal=pdf,scale=.8]plot  sin(x)\end{gnuplot}
	\end{minipage}
	\\
	\begin{minipage}[t]{.4\textwidth}
		\begin{gnuplot}[terminal=pdf,scale=.8]plot  sin(x)\end{gnuplot}
	\end{minipage}
\end{sidewaysfigure}

\end{document}
But now I recognized, that I do not want to have a seperate page for the images. I also want to have text on the page, but this should not be landscaped.

I tried to understand the floatrow package.

Code: Select all

\documentclass[10pt,a4paper,captions=nooneline]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{gnuplottex}
\usepackage{floatrow}
\begin{document}

\begin{figure}
\begin{floatrow}
	\ffigbox{\caption{test}}{\begin{gnuplot}[terminal=pdf,scale=.8]plot sin(x)\end{gnuplot}}
	\ffigbox{\caption{test}}{\begin{gnuplot}[terminal=pdf,scale=.8]plot sin(x)\end{gnuplot}}
\end{floatrow}
\end{figure}
test test
\end{document}
But I get errors when I use gnuplot as object:
  • ! Argument of \verbatim@ has an extra }.
  • ! Paragraph ended before \verbatim@ was complete.
  • ! Extra }, or forgotten \endgroup.
And also the figures are not rotated yet. Can you fix this for me, please?

Edit: I accepted, that it is stupid to use a landscaped figure and normal text on the same page. My question was answered, I have a new approach so I'll open a new thread for that. Thanks again, Thorsten!
Post Reply