how to get two figures side by side in latex code example
Example 1: latex two figure side by side
\documentclass[10pt,a4paper]{article}
\usepackage[demo]{graphicx}
\usepackage{subfig}
\begin{document}
\begin{figure}
\centering
\subfloat[label 1]{{\includegraphics[width=5cm]{img1} }}
\qquad
\subfloat[label 2]{{\includegraphics[width=5cm]{img2} }}
\caption{2 Figures side by side}
\label{fig:example}
\end{figure}
\end{document}
Example 2: figures in latex side by side
\documentclass{article}\usepackage{graphicx}\begin{document}\begin{figure}[!tbp] \centering \begin{minipage}[b]{0.4\textwidth} \includegraphics[width=\textwidth]{flower1.jpg} \caption{Flower one.} \end{minipage} \hfill \begin{minipage}[b]{0.4\textwidth} \includegraphics[width=\textwidth]{flower2.jpg} \caption{Flower two.} \end{minipage}\end{figure}\end{document}