我的字体没有调整

我的字体没有调整

我想在这些块的边上写上带下标的 Class。但我的字体把一切都搞乱了。我不想使用包,因为我的整个文档字体都没问题。有没有办法把字体弄小或用其他东西来调整我的类标签。这是我的输出: 在此处输入图片描述

\setlength\unitlength{1cm}
\begin{picture}(5,5)
\multiput(0.1,0.1)(0,1){6}{\line(1,0){5}}
\multiput(0.1,0.1)(1,0){6}{\line(0,1){5}}

\put(0.5,0.5){0}
\put(1.5,0.5){0}
\put(2.5,0.5){0}
\put(3.5,0.5){0}
\put(4.5,0.5){5}


\put(0.5,1.5){0}
\put(1.5,1.5){0}
\put(2.5,1.5){0}
\put(3.5,1.5){5}
\put(4.5,1.5){0}

\put(0.5,2.5){0}
\put(1.5,2.5){0}
\put(2.5,2.5){5}
\put(3.5,2.5){0}
\put(4.5,2.5){0}

\put(0.5,3.5){0}
\put(1.5,3.5){5}
\put(2.5,3.5){0}
\put(3.5,3.5){0}
\put(4.5,3.5){0}

\put(0.5,4.5){5}
\put(1.5,4.5){0}
\put(2.5,4.5){0}
\put(3.5,4.5){0}
\put(4.5,4.5){0}

\put(-0.5,4.5){$Class_{N}$}
\put(-0.5,3.5){$Class_{M}$}
\put(-0.5,2.5){$Class_{G}$}
\put(-0.5,1.5){$Class_F$}
\put(-0.5,0.5){$Class_E$}

\put(0.5,5.5){$Class_{N}$}
\put(1.5,5.5){$Class_{M}$}
\put(2.5,5.5){$Class_{G}$}
\put(3.5,5.5){$Class_{F}$}
\put(4.5,5.5){$Class_{E}$}

\put (-1.2,1.5){\rotatebox{90}{Actual class}}
\put(2.1,6.2){Predicted Class}
\end{picture}

答案1

请始终发布可编译的示例而不仅仅是代码片段,以便人们不必通过猜测来拼凑事物。

您可以在图片内局部更改字体大小。例如,

\documentclass{article}
\usepackage{rotating}
\begin{document}
\setlength\unitlength{1cm}
\begin{picture}(5,5)
  \multiput(0.1,0.1)(0,1){6}{\line(1,0){5}}
  \multiput(0.1,0.1)(1,0){6}{\line(0,1){5}}

  \put(0.5,0.5){0}
  \put(1.5,0.5){0}
  \put(2.5,0.5){0}
  \put(3.5,0.5){0}
  \put(4.5,0.5){5}

  \put(0.5,1.5){0}
  \put(1.5,1.5){0}
  \put(2.5,1.5){0}
  \put(3.5,1.5){5}
  \put(4.5,1.5){0}

  \put(0.5,2.5){0}
  \put(1.5,2.5){0}
  \put(2.5,2.5){5}
  \put(3.5,2.5){0}
  \put(4.5,2.5){0}

  \put(0.5,3.5){0}
  \put(1.5,3.5){5}
  \put(2.5,3.5){0}
  \put(3.5,3.5){0}
  \put(4.5,3.5){0}

  \put(0.5,4.5){5}
  \put(1.5,4.5){0}
  \put(2.5,4.5){0}
  \put(3.5,4.5){0}
  \put(4.5,4.5){0}

  {\tiny
  \put(-0.85,4.5){$Class_{N}$}
  \put(-0.85,3.5){$Class_{M}$}
  \put(-0.85,2.5){$Class_{G}$}
  \put(-0.85,1.5){$Class_F$}
  \put(-0.85,0.5){$Class_E$}

  \put(0.15,5.5){$Class_{N}$}
  \put(1.15,5.5){$Class_{M}$}
  \put(2.15,5.5){$Class_{G}$}
  \put(3.15,5.5){$Class_{F}$}
  \put(4.15,5.5){$Class_{E}$}}

  \put (-1.2,1.5){\rotatebox{90}{Actual class}}
  \put(1.6,6.2){Predicted Class}
\end{picture}
\end{document}

字体的局部大小改变

不过,我认为如果您仅使用字母作为标签而不重复“类”,您的图表会更清晰。

也就是说,

只是字母

它提供了相同的信息,强调了不同的关键元素。(它们都是类 - 这是常见的,并在整个行/列的标题中给出。行/单元格指示符中重要的是哪个课程。

\documentclass{article}
\usepackage{rotating}
\begin{document}
\setlength\unitlength{1cm}
\begin{picture}(5,5)
  \multiput(0.1,0.1)(0,1){6}{\line(1,0){5}}
  \multiput(0.1,0.1)(1,0){6}{\line(0,1){5}}

  \put(0.5,0.5){0}
  \put(1.5,0.5){0}
  \put(2.5,0.5){0}
  \put(3.5,0.5){0}
  \put(4.5,0.5){5}

  \put(0.5,1.5){0}
  \put(1.5,1.5){0}
  \put(2.5,1.5){0}
  \put(3.5,1.5){5}
  \put(4.5,1.5){0}

  \put(0.5,2.5){0}
  \put(1.5,2.5){0}
  \put(2.5,2.5){5}
  \put(3.5,2.5){0}
  \put(4.5,2.5){0}

  \put(0.5,3.5){0}
  \put(1.5,3.5){5}
  \put(2.5,3.5){0}
  \put(3.5,3.5){0}
  \put(4.5,3.5){0}

  \put(0.5,4.5){5}
  \put(1.5,4.5){0}
  \put(2.5,4.5){0}
  \put(3.5,4.5){0}
  \put(4.5,4.5){0}


  \put(-0.5,4.5){$N$}
  \put(-0.5,3.5){$M$}
  \put(-0.5,2.5){$G$}
  \put(-0.5,1.5){$F$}
  \put(-0.5,0.5){$E$}

  \put(0.5,5.5){$N$}
  \put(1.5,5.5){$M$}
  \put(2.5,5.5){$G$}
  \put(3.5,5.5){$F$}
  \put(4.5,5.5){$E$}

  \put (-1.2,1.5){\rotatebox{90}{Actual class}}
  \put(1.6,6.2){Predicted Class}
\end{picture}
\end{document}

答案2

当然可以,但是为什么你不想使用一些来自这个千年的包呢?

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\setlength\unitlength{1cm}
\begin{picture}(5,5)
\multiput(0.1,0.1)(0,1){6}{\line(1,0){5}}
\multiput(0.1,0.1)(1,0){6}{\line(0,1){5}}

\put(0.5,0.5){0}
\put(1.5,0.5){0}
\put(2.5,0.5){0}
\put(3.5,0.5){0}
\put(4.5,0.5){5}


\put(0.5,1.5){0}
\put(1.5,1.5){0}
\put(2.5,1.5){0}
\put(3.5,1.5){5}
\put(4.5,1.5){0}

\put(0.5,2.5){0}
\put(1.5,2.5){0}
\put(2.5,2.5){5}
\put(3.5,2.5){0}
\put(4.5,2.5){0}

\put(0.5,3.5){0}
\put(1.5,3.5){5}
\put(2.5,3.5){0}
\put(3.5,3.5){0}
\put(4.5,3.5){0}

\put(0.5,4.5){5}
\put(1.5,4.5){0}
\put(2.5,4.5){0}
\put(3.5,4.5){0}
\put(4.5,4.5){0}

\put(-0.5,4.5){\makebox[0pt]{$\scriptstyle \mathit{Class}_{N}$}}
\put(-0.5,3.5){\makebox[0pt]{$\scriptstyle \mathit{Class}_{M}$}}
\put(-0.5,2.5){\makebox[0pt]{$\scriptstyle \mathit{Class}_{G}$}}
\put(-0.5,1.5){\makebox[0pt]{$\scriptstyle \mathit{Class}_F$}}
\put(-0.5,0.5){\makebox[0pt]{$\scriptstyle \mathit{Class}_E$}}

\put(0.5,5.5){\makebox[0pt]{$\scriptstyle \mathit{Class}_{N}$}}
\put(1.5,5.5){\makebox[0pt]{$\scriptstyle \mathit{Class}_{M}$}}
\put(2.5,5.5){\makebox[0pt]{$\scriptstyle \mathit{Class}_{G}$}}
\put(3.5,5.5){\makebox[0pt]{$\scriptstyle \mathit{Class}_{F}$}}
\put(4.5,5.5){\makebox[0pt]{$\scriptstyle \mathit{Class}_{E}$}}

\put (-1.2,1.5){\rotatebox{90}{Actual class}}
\put(2.1,6.2){Predicted Class}
\end{picture}
\end{document}

在此处输入图片描述

我只是阐明了大卫卡莱尔的建议并以临时方式将文本居中,因为我忘记了语法\put

相关内容