表格中本不应该有垂直线

表格中本不应该有垂直线
\begin{table*}
\renewcommand\arraystretch{2}
    \begin{tabular}{|c|c|c|c|c|c|c|c|c|}
    \cline{3-9} 
&&\multicolumn{7}{|c|}{Hashtag-dataset}
\\\cline{3-9} 
    &&Joy & Fear &Sadness &Thankfulness & Anger & Surprise & Love
   \\  \cline{1-9} 

&    Joy          & 70,80\% & 5,78\% & 3,53\% & 22,89\% & 1,62\% & 16,73\% & 19,63\% \\ \cline{2-9}
   \multirow{4}{*}{\rotatebox[origin=c]{90}{Crowdsource-set}} &  Fear         & 3,53\% & 69,77\% & 2,94\% & 1,66\% & 1,37\% & 5,53\% & 1,32\% \\ \cline{2-9}
   &  Sadness      & 5,61\% & 12,97\% & 74,33\% & 4,72\% & 16,06\% & 40,84\% & 6,12\% \\  \cline{2-9}
   & Thankfulness & 4,31\% & 0,59\% & 0,56\% & 53,22\% & 0,20\% & 1,36\% & 6,59\% \\ \cline{2-9}
   & Anger        & 2,74\% & 9,13\% & 15,06\% & 2,79\% & 79,28\% & 20,40\% & 2,21\% \\ \cline{2-9}
   & Surprise     & 0,70\% & 0,21\% & 0,23\% & 0,35\% & 0,18\% & 8,12\% & 0,30\% \\ \cline{2-9}
   & Love         & 12,31\% & 1,56\% & 3,34\% & 14,37\% & 1,30\% & 7,03\% & 63,83\% \\ 
\hline
    \end{tabular}
    \caption {Redistribution of the labels from the hasthag-dataset to the crowdsource-dataset}
\end{table*}

在此处输入图片描述

我不知道如何删除表格左侧的两条垂直线。

有什么帮助吗?

答案1

您需要在要删除垂直规则的位置重新设置前两列,因为这些规则是在tabular列规范中设置的,并使用每个行。下面我对此进行了更正,并且添加了booktabs对事物的看法:

在此处输入图片描述

\documentclass{article}
\usepackage{graphicx,booktabs,multirow}% http://ctan.org/pkg/{graphicx,booktabs,multirow}
\begin{document}
\begin{table}
  \renewcommand\arraystretch{2}
  \begin{tabular}{|c|c|c|c|c|c|c|c|c|}
    \cline{3-9} 
    \multicolumn{2}{c|}{} & \multicolumn{7}{c|}{Hashtag-dataset} \\
    \cline{3-9} 
    \multicolumn{2}{c|}{} & Joy & Fear & Sadness & Thankfulness & Anger & Surprise & Love \\
    \hline 
    &    Joy          & 70,80\% & 5,78\% & 3,53\% & 22,89\% & 1,62\% & 16,73\% & 19,63\% \\
    \cline{2-9}
    \multirow{5}{*}{\rotatebox[origin=c]{90}{Crowdsource-set}} 
      & Fear & 3,53\% & 69,77\% & 2,94\% & 1,66\% & 1,37\% & 5,53\% & 1,32\% \\
    \cline{2-9}
      &  Sadness      & 5,61\% & 12,97\% & 74,33\% & 4,72\% & 16,06\% & 40,84\% & 6,12\% \\
    \cline{2-9}
      & Thankfulness & 4,31\% & 0,59\% & 0,56\% & 53,22\% & 0,20\% & 1,36\% & 6,59\% \\
    \cline{2-9}
      & Anger        & 2,74\% & 9,13\% & 15,06\% & 2,79\% & 79,28\% & 20,40\% & 2,21\% \\
    \cline{2-9}
      & Surprise     & 0,70\% & 0,21\% & 0,23\% & 0,35\% & 0,18\% & 8,12\% & 0,30\% \\
    \cline{2-9}
      & Love         & 12,31\% & 1,56\% & 3,34\% & 14,37\% & 1,30\% & 7,03\% & 63,83\% \\ 
    \hline
  \end{tabular}
  \caption {Redistribution of the labels from the hasthag-dataset to the crowdsource-dataset}
\end{table}

\begin{table}
  \renewcommand\arraystretch{2}
  \begin{tabular}{l*{7}{c}}
    \toprule
    \multirow{2}{*}{\begin{tabular}{@{}c@{}}Crowdsource-\\dataset\end{tabular}} 
      & \multicolumn{7}{c}{\textbf{Hashtag-dataset}} \\
    \cmidrule{2-8} 
    & Joy & Fear & Sadness & Thankfulness & Anger & Surprise & Love \\
    \midrule
      Joy          & 70,80\% & 5,78\% & 3,53\% & 22,89\% & 1,62\% & 16,73\% & 19,63\% \\
      Fear         & 3,53\% & 69,77\% & 2,94\% & 1,66\% & 1,37\% & 5,53\% & 1,32\% \\
      Sadness      & 5,61\% & 12,97\% & 74,33\% & 4,72\% & 16,06\% & 40,84\% & 6,12\% \\
      Thankfulness & 4,31\% & 0,59\% & 0,56\% & 53,22\% & 0,20\% & 1,36\% & 6,59\% \\
      Anger        & 2,74\% & 9,13\% & 15,06\% & 2,79\% & 79,28\% & 20,40\% & 2,21\% \\
      Surprise     & 0,70\% & 0,21\% & 0,23\% & 0,35\% & 0,18\% & 8,12\% & 0,30\% \\
      Love         & 12,31\% & 1,56\% & 3,34\% & 14,37\% & 1,30\% & 7,03\% & 63,83\% \\ 
    \bottomrule
  \end{tabular}
  \caption {Redistribution of the labels from the hasthag-dataset to the crowdsource-dataset}
\end{table}

\end{document}

您还可以考虑使用r-column 甚至dcolumn改善数据的一致性。

答案2

使用S来自siunitx包裹:

\documentclass{article}

\usepackage[
%  locale = DE
]{siunitx}
\usepackage{booktabs,multirow}

\begin{document}

\begin{table}
 \renewcommand\arraystretch{1.5}
  \begin{tabular}{l *{7}{S[table-format = 2.2]}}
    \toprule
     \multirow{2}{*}{\begin{tabular}{@{}c@{}}Crowdsource-\\dataset\end{tabular}} & \multicolumn{7}{c}{\textbf{Hashtag-dataset}}                  \\
     \cmidrule{2-8}
                   & {Joy}           & {Fear}          & {Sadness}       & {Thankfulness}  & {Anger}         & {Surprise}      & {Love}          \\
     \midrule
                   & {\si{\percent}} & {\si{\percent}} & {\si{\percent}} & {\si{\percent}} & {\si{\percent}} & {\si{\percent}} & {\si{\percent}} \\
    \midrule
      Joy          & 70.80           &  5.78           &  3.53           & 22.89           &  1.62           & 16.73           & 19.63           \\
      Fear         &  3.53           & 69.77           &  2.94           &  1.66           &  1.37           &  5.53           &  1.32           \\
      Sadness      &  5.61           & 12.97           & 74.33           &  4.72           & 16.06           & 40.84           &  6.12           \\
      Thankfulness &  4.31           &  0.59           &  0.56           & 53.22           &  0.20           &  1.36           &  6.59           \\
      Anger        &  2.74           &  9.13           & 15.06           &  2.79           & 79.28           & 20.40           &  2.21           \\
      Surprise     &  0.70           &  0.21           &  0.23           &  0.35           &  0.18           &  8.12           &  0.30           \\
      Love         & 12.31           &  1.56           &  3.34           & 14.37           &  1.30           &  7.03           & 63.83           \\ 
    \bottomrule
  \end{tabular}
 \caption{Redistribution of the labels from the hasthag-dataset to the crowdsource-dataset.}
\end{table}

\end{document}

输出

注意

(1)该siunitx包可以处理列内的对齐和排版的物理量正确,

(2)我把单位移到了列的上方;这提高了可读性。

PS 表格顶部的代码是从沃纳的回答

相关内容