How can I position two graphs next to each other so that it looks good?
For putting two figures next to each other I found the solution below in another question around here, however, I would like both figures to be shifted a bit to the left so that they stick out both on the left and right side of the text line equally instead of only on the right side.
Also, what would be the best way to horizontally align the two figures? All I could figure out is making the caption of the left figure longer than that of the right figure so that it pushes up the graph.
Here's my code:
\begin{figure}[!tbp]
\centering
\begin{minipage}[b]{0.4\textwidth}
\scalebox{.9}{\input{./graf/LVQ.tex}}
\caption{Caption Figure 4}
\end{minipage}
\hfill
\begin{minipage}[b]{0.4\textwidth}
\scalebox{.55}{\input{./graf/baselinererun.tex}}
\caption{Caption Figure 5}
\end{minipage}
\end{figure}
Best Answer
Many options are available for placing two figures side-by-side. See this question and the answers therein, for example.
Here is a solution using the the
subfig
package:Details
First of all make sure the figures use the same font size, line widths, etc. as pointed out by @prettygully in a comment to see the solution work.
I used the
[demo]
option forgraphicx
to insert wide enough dummy figures, in your document, use the actual ones. Also, I used thegeometry
package option[showframe]
to show how the figures are centered w.r.t. the page margins, in your real document, you don't need it.Second, for placing figures side-by-side, you have several options each having it own pros and cons:
minipage
with thesubcaption
package to add a caption to eachminipage
subfig
package which is options-rich and has a\captionsetup
command for easy control of the output.floatrow
package designed for these purposescaptionof
command from thecaption
/subcation
packages.The first option (
minipage
) requires manual width adjustments in addition to a much difficulty aligning the figures with different captions length.The third option (
floatrow
) has some limitations on caption setupThe fourth option has some cross-referencing problems
The second option is, IMHO, the best choice. It doesn't need manual width adjustments, where the natural width of the figures will be used and it works for figures of different widths and/or heights. Also, with
\captionsetup
command we can control the caption appearance and it doesn't require thecaption
package.Third, for centering the two figures w.r.t. the page margins, we can use the
\makebox
command fromgraphicx
. Essentially,\makebox[\textwidth]
makes the box only\textwidth
wide (whatever the actual width can be) which also avoids "Overfull hbox" errors. The second optional argument of\makebox
is used to align it in the center. I got the idea from an answer to this question.Another option for the same purpose is using the
adjustbox
package, which has many alignment options to be used.