[Tex/LaTex] Splitting correlation Matrix in 2 Tables

matricessplit

H! I have a correlation matrix of 14×14 variables – so quite big.
If I insert my correlation matrix in Latex, and adjust the table to the page size with begin{adjustbox}{widt=\textwith}, the table is printed extremely small and not nice to read anymore.

How can i Therefore split the correlation matrix in 2 tables beyond each other? So for example first a table of the first 7×7 variables, and then beyond it the second 7×7 variables?

This is my code of the table:

    \begin{table}[!htbp] \centering 
  \caption{} 
  \label{} 
  \begin{adjustbox}{width=\textwidth}
\begin{tabular}{@{\extracolsep{5pt}} ccccccccccccccc} 
\\[-1.8ex]\hline 
\hline \\[-1.8ex] 
 & roap & id & size & age & listed & source & country & gics20 & gics25 & gics30 & gics40 & gics45 & gics50 & gics60 \\ 
\hline \\[-1.8ex] 
roap & $1$ & $0.265$ & $0.360$ & $$-$0.222$ & $0.077$ & $0.202$ & $$-$0.032$ & $$-$0.206$ & $0.268$ & $0.019$ & $$-$0.376$ & $0.310$ & $0.109$ & $$-$0.009$ \\ 
id & $0.265$ & $1$ & $0.385$ & $0.029$ & $$-$0.194$ & $$-$0.036$ & $$-$0.239$ & $$-$0.163$ & $0.114$ & $0.321$ & $$-$0.176$ & $0.102$ & $$-$0.014$ & $$-$0.358$ \\ 
size & $0.360$ & $0.385$ & $1$ & $0.126$ & $0.326$ & $$-$0.121$ & $$-$0.151$ & $$-$0.048$ & $0.138$ & $$-$0.150$ & $$-$0.033$ & $0.466$ & $$-$0.103$ & $$-$0.149$ \\ 
age & $$-$0.222$ & $0.029$ & $0.126$ & $1$ & $0.150$ & $$-$0.362$ & $$-$0.141$ & $$-$0.010$ & $$-$0.110$ & $$-$0.043$ & $0.488$ & $$-$0.103$ & $$-$0.181$ & $$-$0.127$ \\ 
listed & $0.077$ & $$-$0.194$ & $0.326$ & $0.150$ & $1$ & $0.014$ & $$-$0.134$ & $0.013$ & $0.167$ & $$-$0.560$ & $0.211$ & $0.217$ & $0.133$ & $$-$0.002$ \\ 
source & $0.202$ & $$-$0.036$ & $$-$0.121$ & $$-$0.362$ & $0.014$ & $1$ & $0.335$ & $0.164$ & $0.188$ & $$-$0.023$ & $$-$0.561$ & $0.041$ & $0.156$ & $0.100$ \\ 
country & $$-$0.032$ & $$-$0.239$ & $$-$0.151$ & $$-$0.141$ & $$-$0.134$ & $0.335$ & $1$ & $0.216$ & $$-$0.214$ & $0.139$ & $$-$0.104$ & $$-$0.037$ & $$-$0.135$ & $0.141$ \\ 
gics20 & $$-$0.206$ & $$-$0.163$ & $$-$0.048$ & $$-$0.010$ & $0.013$ & $0.164$ & $0.216$ & $1$ & $$-$0.182$ & $$-$0.269$ & $$-$0.202$ & $$-$0.124$ & $$-$0.208$ & $$-$0.097$ \\ 
gics25 & $0.268$ & $0.114$ & $0.138$ & $$-$0.110$ & $0.167$ & $0.188$ & $$-$0.214$ & $$-$0.182$ & $1$ & $$-$0.229$ & $$-$0.172$ & $$-$0.106$ & $$-$0.177$ & $$-$0.083$ \\ 
gics30 & $0.019$ & $0.321$ & $$-$0.150$ & $$-$0.043$ & $$-$0.560$ & $$-$0.023$ & $0.139$ & $$-$0.269$ & $$-$0.229$ & $1$ & $$-$0.253$ & $$-$0.156$ & $$-$0.261$ & $$-$0.122$ \\ 
gics40 & $$-$0.376$ & $$-$0.176$ & $$-$0.033$ & $0.488$ & $0.211$ & $$-$0.561$ & $$-$0.104$ & $$-$0.202$ & $$-$0.172$ & $$-$0.253$ & $1$ & $$-$0.117$ & $$-$0.196$ & $$-$0.091$ \\ 
gics45 & $0.310$ & $0.102$ & $0.466$ & $$-$0.103$ & $0.217$ & $0.041$ & $$-$0.037$ & $$-$0.124$ & $$-$0.106$ & $$-$0.156$ & $$-$0.117$ & $1$ & $$-$0.121$ & $$-$0.056$ \\ 
gics50 & $0.109$ & $$-$0.014$ & $$-$0.103$ & $$-$0.181$ & $0.133$ & $0.156$ & $$-$0.135$ & $$-$0.208$ & $$-$0.177$ & $$-$0.261$ & $$-$0.196$ & $$-$0.121$ & $1$ & $$-$0.094$ \\ 
gics60 & $$-$0.009$ & $$-$0.358$ & $$-$0.149$ & $$-$0.127$ & $$-$0.002$ & $0.100$ & $0.141$ & $$-$0.097$ & $$-$0.083$ & $$-$0.122$ & $$-$0.091$ & $$-$0.056$ & $$-$0.094$ & $1$ \\ 
\hline \\[-1.8ex] 
\end{tabular} 
\end{adjustbox}
\end{table} 

And it is printed as follow:
Correlation Matrix printed very small

Any suggestions?
Thanks for your help!

Best Answer

As you've discovered, using \adjustbox does not tend to create usable results -- at least not when trying to create attractive tables. I suggest you do the following instead:

  • display the table in landscape format, using the sidewaystable environment of the rotating package;

  • use a tabular* environment to ensure that the table fits inside the text block;

  • use the S column type of the siunitx package to align the numbers on their respective explicit or implicit decimal markers; and

  • use the macros of the booktabs package -- \toprule, \midrule, \bottomrule -- instead of \hline to generate well-spaced horizontal lines. Optionally, use \addlinespace directives (also provided by the booktabs package) to insert a bit of whitespace after every fifth row or so.

enter image description here

\documentclass{article}
\usepackage{booktabs,siunitx,rotating}
\begin{document}

\begin{sidewaystable} 
\setlength\tabcolsep{0pt} % make LaTeX figure out the intercolumn whitespace amount
\caption{} \label{} 
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} l *{14}{S[table-format=-1.3]} } 
\toprule 
 & {roap} & {id} & {size} & {age} & {listed} & {source} & {country} & {gics20} & {gics25} & {gics30} & {gics40} & {gics45} & {gics50} & {gics60} \\ 
\midrule
roap & 1 & 0.265 & 0.360 & -0.222 & 0.077 & 0.202 & -0.032 & -0.206 & 0.268 & 0.019 & -0.376 & 0.310 & 0.109 & -0.009 \\ 
id & 0.265 & 1 & 0.385 & 0.029 & -0.194 & -0.036 & -0.239 & -0.163 & 0.114 & 0.321 & -0.176 & 0.102 & -0.014 & -0.358 \\ 
size & 0.360 & 0.385 & 1 & 0.126 & 0.326 & -0.121 & -0.151 & -0.048 & 0.138 & -0.150 & -0.033 & 0.466 & -0.103 & -0.149 \\ 
age & -0.222 & 0.029 & 0.126 & 1 & 0.150 & -0.362 & -0.141 & -0.010 & -0.110 & -0.043 & 0.488 & -0.103 & -0.181 & -0.127 \\ 
listed & 0.077 & -0.194 & 0.326 & 0.150 & 1 & 0.014 & -0.134 & 0.013 & 0.167 & -0.560 & 0.211 & 0.217 & 0.133 & -0.002 \\ \addlinespace % optional
source & 0.202 & -0.036 & -0.121 & -0.362 & 0.014 & 1 & 0.335 & 0.164 & 0.188 & -0.023 & -0.561 & 0.041 & 0.156 & 0.100 \\ 
country & -0.032 & -0.239 & -0.151 & -0.141 & -0.134 & 0.335 & 1 & 0.216 & -0.214 & 0.139 & -0.104 & -0.037 & -0.135 & 0.141 \\ 
gics20 & -0.206 & -0.163 & -0.048 & -0.010 & 0.013 & 0.164 & 0.216 & 1 & -0.182 & -0.269 & -0.202 & -0.124 & -0.208 & -0.097 \\ 
gics25 & 0.268 & 0.114 & 0.138 & -0.110 & 0.167 & 0.188 & -0.214 & -0.182 & 1 & -0.229 & -0.172 & -0.106 & -0.177 & -0.083 \\ 
gics30 & 0.019 & 0.321 & -0.150 & -0.043 & -0.560 & -0.023 & 0.139 & -0.269 & -0.229 & 1 & -0.253 & -0.156 & -0.261 & -0.122 \\ \addlinespace % optional
gics40 & -0.376 & -0.176 & -0.033 & 0.488 & 0.211 & -0.561 & -0.104 & -0.202 & -0.172 & -0.253 & 1 & -0.117 & -0.196 & -0.091 \\ 
gics45 & 0.310 & 0.102 & 0.466 & -0.103 & 0.217 & 0.041 & -0.037 & -0.124 & -0.106 & -0.156 & -0.117 & 1 & -0.121 & -0.056 \\ 
gics50 & 0.109 & -0.014 & -0.103 & -0.181 & 0.133 & 0.156 & -0.135 & -0.208 & -0.177 & -0.261 & -0.196 & -0.121 & 1 & -0.094 \\ 
gics60 & -0.009 & -0.358 & -0.149 & -0.127 & -0.002 & 0.100 & 0.141 & -0.097 & -0.083 & -0.122 & -0.091 & -0.056 & -0.094 & 1 \\ 
\bottomrule
\end{tabular*}
\end{sidewaystable} 
\end{document}

Addendum: If the page margins of your document are at most 1" wide, it's actually possible to display the correlation matrix in portrait mode as long as you show just two rather than three digits after the decimal marker. Compared with the code above, all you'd have to do is (a) switch from a sidewaystable to a regular table environment, and (b) instruct Latex to round the numbers in the 14 data columns to 2 digits; the latter may be achieved easily by running the instruction

\sisetup{round-mode=places,round-precision=2}

at the top of the table environment. All other elements, such as the use of the S column type for data columns and of a tabular* environment, needn't be changed.

enter image description here

\documentclass{article}
\usepackage[a4paper,margin=2.5cm]{geometry} % set page margins suitably
\usepackage{booktabs,siunitx}
\begin{document}
\begin{table} % <-- new: 'table' instead of 'sidewaystable'
\sisetup{round-mode=places,round-precision=2} % <-- new
\setlength\tabcolsep{0pt} 
\caption{\strut} \label{} 

% Change 'S[table-format=-1.3]' to 'S[table-format=-1.2]':
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} l *{14}{S[table-format=-1.2]} } 
\toprule 
 & {roap} & {id} & {size} & {age} & {listed} & {source} & {country} & {gics20} & {gics25} & {gics30} & {gics40} & {gics45} & {gics50} & {gics60} \\ 
\midrule
roap & 1 & 0.265 & 0.360 & -0.222 & 0.077 & 0.202 & -0.032 & -0.206 & 0.268 & 0.019 & -0.376 & 0.310 & 0.109 & -0.009 \\ 
id & 0.265 & 1 & 0.385 & 0.029 & -0.194 & -0.036 & -0.239 & -0.163 & 0.114 & 0.321 & -0.176 & 0.102 & -0.014 & -0.358 \\ 
size & 0.360 & 0.385 & 1 & 0.126 & 0.326 & -0.121 & -0.151 & -0.048 & 0.138 & -0.150 & -0.033 & 0.466 & -0.103 & -0.149 \\ 
age & -0.222 & 0.029 & 0.126 & 1 & 0.150 & -0.362 & -0.141 & -0.010 & -0.110 & -0.043 & 0.488 & -0.103 & -0.181 & -0.127 \\ 
listed & 0.077 & -0.194 & 0.326 & 0.150 & 1 & 0.014 & -0.134 & 0.013 & 0.167 & -0.560 & 0.211 & 0.217 & 0.133 & -0.002 \\ \addlinespace
source & 0.202 & -0.036 & -0.121 & -0.362 & 0.014 & 1 & 0.335 & 0.164 & 0.188 & -0.023 & -0.561 & 0.041 & 0.156 & 0.100 \\ 
country & -0.032 & -0.239 & -0.151 & -0.141 & -0.134 & 0.335 & 1 & 0.216 & -0.214 & 0.139 & -0.104 & -0.037 & -0.135 & 0.141 \\ 
gics20 & -0.206 & -0.163 & -0.048 & -0.010 & 0.013 & 0.164 & 0.216 & 1 & -0.182 & -0.269 & -0.202 & -0.124 & -0.208 & -0.097 \\ 
gics25 & 0.268 & 0.114 & 0.138 & -0.110 & 0.167 & 0.188 & -0.214 & -0.182 & 1 & -0.229 & -0.172 & -0.106 & -0.177 & -0.083 \\ 
gics30 & 0.019 & 0.321 & -0.150 & -0.043 & -0.560 & -0.023 & 0.139 & -0.269 & -0.229 & 1 & -0.253 & -0.156 & -0.261 & -0.122 \\ \addlinespace
gics40 & -0.376 & -0.176 & -0.033 & 0.488 & 0.211 & -0.561 & -0.104 & -0.202 & -0.172 & -0.253 & 1 & -0.117 & -0.196 & -0.091 \\ 
gics45 & 0.310 & 0.102 & 0.466 & -0.103 & 0.217 & 0.041 & -0.037 & -0.124 & -0.106 & -0.156 & -0.117 & 1 & -0.121 & -0.056 \\ 
gics50 & 0.109 & -0.014 & -0.103 & -0.181 & 0.133 & 0.156 & -0.135 & -0.208 & -0.177 & -0.261 & -0.196 & -0.121 & 1 & -0.094 \\ 
gics60 & -0.009 & -0.358 & -0.149 & -0.127 & -0.002 & 0.100 & 0.141 & -0.097 & -0.083 & -0.122 & -0.091 & -0.056 & -0.094 & 1 \\ 
\bottomrule
\end{tabular*}
\end{table} 
\end{document}
Related Question