0

I am not be able to fix this format of placing figure and table side by side. I understand that there are 2 methods do it, one is using the floatrow and another one using minpage. I tried both the methods but not be able execute and get the result.

Here is my code and I hope someone can help me solve the issue on what I am doing wrong here. I spent almost 2 hours on this but wasted.

\begin{figure}
%\begin{floatrow}
    %\begin{minipage}[b]{0.56\linewidth}
    \centering
    \begin{minipage}{0.5\textwidth}
    \centering
    \includegraphics[width=0.45\textwidth]{roc_fi} % you can use other formats too
    \caption{ROC curve tells how much variation in the data is explained by the model, in this is  .        \label{fig:eva}}
    \end{minipage}
%\end{figure}
%\end{minipage}\hfill

\begin{table} %\begin{minipage}[b]{0.4\linewidth} \centering \begin{minipage} \centering \begin{tabular}{|c| p{1,5cm} |c|} \hline \textbf{Samples} & \textbf{Accuracy} & \textbf{Recall}\ [0.5ex] \hline\hline S1 & 0.86 & 0.81 \ \hline S2 & 0.89 & 0.85 \ \hline S3 & 0.84 & 0.81 \ \hline S4 & 0.88 & 0.83 \ \hline S5 & 0.86 & 0.81 \ \hline S6 & 0.88 & 0.82\ \hline S7 & 0.87 & 0.83 \ \hline S8 & 0.82 & 0.78 \ \hline S9 & 0.87 & 0.83 \ \hline ALL & 0.85 & 0.8 \ [1ex] \hline \end{tabular} \caption{Validation conducted on several samples of input datasets and the respective measure accuracy and recall are reported here. Both the measures are fairly stable across different samples.\label{tab:table1}}

\end{table}

\end{minipage}

%\end{floatrow} \end{figure}

campa
  • 31,130
mkpisk
  • 3

2 Answers2

1

See if the following solution is what you after:

\documentclass{article}
\usepackage[demo]{graphicx} % in real document remove option "demo"
\usepackage{caption}

\begin{document} \begin{figure} \begin{minipage}{0.56\linewidth} \centering \includegraphics[width=\linewidth]{roc_fi} % you can use other formats too \caption{ROC curve tells how much variation in the data is explained by the model, in this is . \label{fig:eva}} \end{minipage} \hfill \begin{minipage}{0.4\linewidth} \begin{tabular}{|c| p{1,5cm} |c|} \hline \textbf{Samples} & \textbf{Accuracy} & \textbf{Recall}\ [0.5ex] \hline\hline S1 & 0.86 & 0.81 \ \hline S2 & 0.89 & 0.85 \ \hline S3 & 0.84 & 0.81 \ \hline S4 & 0.88 & 0.83 \ \hline S5 & 0.86 & 0.81 \ \hline S6 & 0.88 & 0.82\ \hline S7 & 0.87 & 0.83 \ \hline S8 & 0.82 & 0.78 \ \hline S9 & 0.87 & 0.83 \ \hline ALL & 0.85 & 0.8 \ [1ex] \hline \end{tabular} \captionof{table}{Validation conducted on several samples of input datasets and the respective measure accuracy and recall are reported here. Both the measures are fairly stable across different samples.\label{tab:table1}} \end{minipage} \end{figure} \end{document}

enter image description here

Zarko
  • 296,517
1

See this answer which uses the floatrow package.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[demo]{graphicx} % remove 'demo' when you compile your document.

\usepackage{floatrow} % Table float box with bottom caption, box width adjusted to content \newfloatcommand{capbtabbox}{table}[][\FBwidth]

\begin{document}

\begin{figure} \begin{floatrow} \ffigbox{% \includegraphics[width=0.45\textwidth]{roc_fi}% }{% \caption{ROC curve tells how much variation in the data is explained by the model, in this is.} \label{fig:eva}% } \capbtabbox{% \begin{tabular}{|c| c |c|} \hline \textbf{Samples} & \textbf{Accuracy} & \textbf{Recall}\ \hline \hline S1 & 0.86 & 0.81 \ \hline S2 & 0.89 & 0.85 \ \hline S3 & 0.84 & 0.81 \ \hline S4 & 0.88 & 0.83 \ \hline S5 & 0.86 & 0.81 \ \hline S6 & 0.88 & 0.82 \ \hline S7 & 0.87 & 0.83 \ \hline S8 & 0.82 & 0.78 \ \hline S9 & 0.87 & 0.83 \ \hline ALL & 0.85 & 0.8 \ \hline \end{tabular} }{% \caption{Validation conducted on several samples of input datasets and the respective measure accuracy and recall are reported here. Both the measures are fairly stable across different samples.}% \label{tab:table1} } \end{floatrow} \end{figure}

\end{document}

enter image description here

Tanvir
  • 1,232