如何在 tikzpicture 中更改节点名称的大小

如何在 tikzpicture 中更改节点名称的大小

这是我的代码,在这个代码中,节点的名称显得非常小,我该如何修改这个尺寸?

\documentclass[10pt]{article}

\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\pagestyle{empty}

\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage{amsmath,amssymb}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{verbatim}
\usepackage{float}

\usepackage{pgf,tikz}
\usetikzlibrary{arrows}


\title{Ecuaciones}
\author{Universidad Nacional de Colombia\\Sede Manizales\\ \\Alumnos:\\Juan Pablo     Muñoz Diaz\\Carlos Fernando Ospina Trujillo\\ }
\begin{document}
\maketitle

%Primera ecuacion
\textbf{Primera ecuacion}



%%
\definecolor{uuuuuu}{rgb}{0.266666666667,0.266666666667,0.266666666667}
\definecolor{zzttqq}{rgb}{0.6,0.2,0.}

\resizebox{5cm}{5cm}{%
\begin{tikzpicture}%[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\clip(-12.6261679156,0.561231972758) rectangle (-1.10615793659,11.8708308106);
\fill[color=zzttqq,fill=zzttqq,fill opacity=0.1] (-11.6117166802,1.30462670705) --         (-1.61171668024,1.30462670705) -- (-1.61171668024,11.3046267071) --         (-11.6117166802,11.3046267071) -- cycle;
\draw[line width=4.pt] (0.997953475103,10.0297333254) -- (11.5185105336,10.0297333254);
\draw (-11.6117166802,1.30462670705)-- (-1.61171668024,1.30462670705);
\draw [color=zzttqq] (-11.6117166802,1.30462670705)-- (-1.61171668024,1.30462670705);
\draw [color=zzttqq] (-1.61171668024,1.30462670705)-- (-1.61171668024,11.3046267071);
\draw [color=zzttqq] (-1.61171668024,11.3046267071)-- (-11.6117166802,11.3046267071);
\draw [color=zzttqq] (-11.6117166802,11.3046267071)-- (-11.6117166802,1.30462670705);
\draw (-6.61171668024,11.3046267071)-- (-6.61171668024,1.30462670705);
\draw (-9.11171668024,11.3046267071)-- (-9.11171668024,1.30462670705);
\draw (-4.11171668024,11.3046267071)-- (-4.11171668024,1.30462670705);
\draw (-11.6117166802,8.80462670705)-- (-1.61171668024,8.80462670705);
\draw (-11.6117166802,6.30462670705)-- (-1.61171668024,6.30462670705);
\draw (-11.6117166802,3.80462670705)-- (-1.61171668024,3.80462670705);
\draw (-6.36643646582,7.71521077251) node[anchor=north west,minimum size=10pt]     {$u_{2}$};
\begin{scriptsize}
\draw [fill=black] (11.5185105336,10.0297333254) circle (5.5pt);
\draw[color=black] (11.9919356012,11.2395973871) node {$lado = 10$};
\draw[color=black] (-6.47164203641,0.929451469805) node {$h$};
\draw [fill=uuuuuu] (-6.61171668024,8.80462670705) circle (5.5pt);
\draw[color=uuuuuu] (-6.15602532465,9.71411661362) node {$u_{6}$};
\draw [fill=uuuuuu] (-6.61171668024,3.80462670705) circle (5.5pt);
\draw[color=uuuuuu] (-6.05081975407,4.71685201085) node {$u_{14}$};
\draw [fill=uuuuuu] (-9.11171668024,6.30462670705) circle (5.5pt);
\draw[color=uuuuuu] (-8.62835623339,7.18918291959) node {$u_{1}$};
\draw [fill=uuuuuu] (-4.11171668024,6.30462670705) circle (5.5pt);
\draw[color=uuuuuu] (-3.63109163062,7.18918291959) node {$u_{3}$};
\end{scriptsize}
\end{tikzpicture}
}
\end{document}

答案1

\resizebox同时缩放图形和文本。最好只应用scale更好tikzpicture

在此处输入图片描述

笔记:

  • 我注释掉了与这个问题无关的内容。
  • 我还注释掉了\begin{scriptsize}\end{scriptsize},因为这也会导致文本字体大小发生变化。我不确定这是否是我想要的。

代码:

\documentclass[10pt]{article}

%\usepackage{pgf,tikz}
%\usetikzlibrary{arrows}
%\pagestyle{empty}
%
%\usepackage[utf8]{inputenc}
%\usepackage[spanish]{babel}
%\usepackage{amsmath,amssymb}
\usepackage{graphicx}
%\usepackage{xcolor}
%\usepackage{verbatim}
%\usepackage{float}
%
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}

%\title{Ecuaciones}
%\author{Universidad Nacional de Colombia\\Sede Manizales\\ \\Alumnos:\\Juan Pablo     Muñoz Diaz\\Carlos Fernando Ospina Trujillo\\ }
\begin{document}
%\maketitle
%
%%Primera ecuacion
%\textbf{Primera ecuacion}
%
%
%
%%
\definecolor{uuuuuu}{rgb}{0.266666666667,0.266666666667,0.266666666667}
\definecolor{zzttqq}{rgb}{0.6,0.2,0.}

%\resizebox{5cm}{5cm}{%
\begin{tikzpicture}[scale=0.5]%[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\clip(-12.6261679156,0.561231972758) rectangle (-1.10615793659,11.8708308106);
\fill[color=zzttqq,fill=zzttqq,fill opacity=0.1] (-11.6117166802,1.30462670705) --         (-1.61171668024,1.30462670705) -- (-1.61171668024,11.3046267071) --         (-11.6117166802,11.3046267071) -- cycle;
\draw[line width=4.pt] (0.997953475103,10.0297333254) -- (11.5185105336,10.0297333254);
\draw (-11.6117166802,1.30462670705)-- (-1.61171668024,1.30462670705);
\draw [color=zzttqq] (-11.6117166802,1.30462670705)-- (-1.61171668024,1.30462670705);
\draw [color=zzttqq] (-1.61171668024,1.30462670705)-- (-1.61171668024,11.3046267071);
\draw [color=zzttqq] (-1.61171668024,11.3046267071)-- (-11.6117166802,11.3046267071);
\draw [color=zzttqq] (-11.6117166802,11.3046267071)-- (-11.6117166802,1.30462670705);
\draw (-6.61171668024,11.3046267071)-- (-6.61171668024,1.30462670705);
\draw (-9.11171668024,11.3046267071)-- (-9.11171668024,1.30462670705);
\draw (-4.11171668024,11.3046267071)-- (-4.11171668024,1.30462670705);
\draw (-11.6117166802,8.80462670705)-- (-1.61171668024,8.80462670705);
\draw (-11.6117166802,6.30462670705)-- (-1.61171668024,6.30462670705);
\draw (-11.6117166802,3.80462670705)-- (-1.61171668024,3.80462670705);
\draw (-6.36643646582,7.71521077251) node[anchor=north west,minimum size=10pt]     {$u_{2}$};
%\begin{scriptsize}
\draw [fill=black] (11.5185105336,10.0297333254) circle (5.5pt);
\draw[color=black] (11.9919356012,11.2395973871) node {$lado = 10$};
\draw[color=black] (-6.47164203641,0.929451469805) node {$h$};
\draw [fill=uuuuuu] (-6.61171668024,8.80462670705) circle (5.5pt);
\draw[color=uuuuuu] (-6.15602532465,9.71411661362) node {$u_{6}$};
\draw [fill=uuuuuu] (-6.61171668024,3.80462670705) circle (5.5pt);
\draw[color=uuuuuu] (-6.05081975407,4.71685201085) node {$u_{14}$};
\draw [fill=uuuuuu] (-9.11171668024,6.30462670705) circle (5.5pt);
\draw[color=uuuuuu] (-8.62835623339,7.18918291959) node {$u_{1}$};
\draw [fill=uuuuuu] (-4.11171668024,6.30462670705) circle (5.5pt);
\draw[color=uuuuuu] (-3.63109163062,7.18918291959) node {$u_{3}$};
%\end{scriptsize}
\end{tikzpicture}%}
\end{document}

答案2

看起来您是从某个绘图软件导出此代码的,因此可读性不够。另一方面,对于这种简单的图表,您可以自己编写代码。以下是一个例子:

\documentclass[tikz,border=5]{standalone}
\definecolor{uuuuuu}{rgb}{0.266666666667,0.266666666667,0.266666666667}
\definecolor{zzttqq}{rgb}{0.6,0.2,0.}
\begin{document}
  \begin{tikzpicture}
    \filldraw[zzttqq,fill opacity=0.1] 
            (-0.5\pgflinewidth,-0.5\pgflinewidth) rectangle ([shift={(0.5\pgflinewidth,0.5\pgflinewidth)}]4,4);
    \foreach \x in {1,2,3} {
        \draw (\x,0) -- (\x,4);
    }
    \foreach \y in {1,2,3} {
        \draw (0,\y) -- (4,\y);
    }
    \foreach \x/\y/\a in {2/-0.2/h,2.3/1.4/u_{14},2.3/2.4/u_{2},2.3/3.4/u_{6},1.3/2.4/u_{1},3.3/2.4/u_{3}} {
        \node[font=\small] at (\x,\y){$\a$};
    }
    \foreach \x/\y in {1/2,2/1,2/3,3/2} {
        \draw[fill=uuuuuu] (\x,\y) circle(1.5pt);
    }
  \end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容