2

I want to change the table generated by the following code so that the first column looks like the figure below by 1- changing the text direction in the first column. I made some changes regarding this post but still have a problem.

Desired output: enter image description here

Current output: enter image description here

\begin{table}[h!]
\centering
\caption[Transformation table]{Transformations generated by Mach et al. Y in a dark cell: highly recommended, Y in a light cell: usable, N in a dark cell: unusable \label{tab:power}}
\begin{tblr}{
  colspec={XXXXXX},
  vlines,
  hlines,
  cells={halign=c},
  column{1-2}={halign=l},
  hspan=even,
}
& \SetCell[c=5]{halign=c,bg=gray,fg=white} Type of Distribution & & & &\\ 
\SetCell[r=5]{bg=gray,fg=white} \parbox[t]{2mm}{\multirow{5}{*}{\rotatebox[origin=c]{90}{Type of \\  Transformation}}} & & Lognormal & Exponential & Gamma & Weibull \\
& Box-Cox & Y & Y & \SetCell{bg=lightgray,font=\bfseries} Y & \SetCell{bg=lightgray,font=\bfseries} Y \\ 
& Exponential & Y & Y & Y & Y\\
& Simple power & Y & \SetCell{bg=lightgray,font=\bfseries} Y & \SetCell{bg=lightgray,font=\bfseries} Y & \SetCell{bg=lightgray,font=\bfseries} Y \\
& Logarithmic & \SetCell{bg=lightgray,font=\bfseries} Y & Y & \SetCell{font=\bfseries} N & \SetCell{font=\bfseries} N \\ 
\end{tblr}
\end{table}


\begin{table}[H]
 \centering
 \begin{tabular}{|c|l|r|r|r|r|}
 \hline
 & \multicolumn{1}{|c|}{Text} & \multicolumn{1}{|c|}{Text} & \multicolumn{1}{|c|}{Text} & \multicolumn{1}{|c|}{Text} & \multicolumn{1}{|c|}{text}\\
 \hline
 \rotatebox{90}{\parbox{2mm}{\multirow{3}{*}{rota}}} & text &&&&\\
 & text &&&&\\
 & text &&&&\\
 \hline
 \end{tabular}
 \end{table}
Abbas
  • 807
  • 7
  • 14

1 Answers1

2

Use the \rotatebox before the \parbox (and don't use \multirow in a tblr, that's no longer defined there):

---
title: "misc"
author: "Me"
date: "`r Sys.Date()`"
output:
  pdf_document:
    keep_tex: true
    extra_dependencies: caption
    number_sections: yes
fig_caption: yes
classoption: table
header-includes:
- \usepackage{tabularray}
language:
  label:
    fig: !expr function(x) sprintf("**Figure %s.** ", x)
fontsize: 11pt
urlcolor: blue
---


\begin{table}[h!]
\centering
\caption[Transformation table]{Transformations generated by Mach et al. Y in a dark cell: highly recommended, Y in a light cell: usable, N in a dark cell: unusable \label{tab:power}}
\begin{tblr}{
  colspec={lXXXXX},
  vlines,
  hlines,
  cells={halign=c},
  column{1-2}={halign=l},
  vspan=even,
  cell{1}{2}={halign=c,bg=gray,fg=white},
  cell{2}{1}={bg=gray,fg=white},
  cell{3}{5-6}={bg=lightgray,font=\bfseries},  
  cell{5}{4-6}={bg=lightgray,font=\bfseries},    
  cell{6}{3}={bg=lightgray,font=\bfseries},      
}
& \SetCell[c=5]{} Type of Distribution & & & &\\ 
\SetCell[r=5]{} \rotatebox{90}{\parbox{3.5cm}{\centering Type of Transformation}} & & Lognormal & Exponential & Gamma & Weibull \\
& Box-Cox & Y & Y & Y & Y \\ 
& Exponential & Y & Y & Y & Y\\
& Simple power & Y & Y & Y & Y \\
& Logarithmic & Y & Y & N & N \\ 
\end{tblr}
\end{table}

enter image description here