[Latex]PGF and Tikz 中label的使用

tikz一般使用node来标注文本,但也可以试试label属性.

label=degree:
degree为角度,也可以是left(180度),right(0度),above(90度),below(270或-90度);
text为需要添加的文本.

例如:

\tikz
\node [circle,draw,label=60:$60^\circ$,label=below:$-90^\circ$] {my circle};
~\\
\tikz
\node [rectangle,rounded corners=1mm,draw,label=120:$120^\circ$,label=below:$-90^\circ$] {my rectangle};
~\\
\begin{tikzpicture}
\coordinate [label=left:\textcolor{blue}{$A$}] (A) at (0,0);
\coordinate [label=right:\textcolor{blue}{$B$}] (B) at (1.25,0.25);
\draw[blue] (A) -- (B);
\end{tikzpicture}

结果如下:

再看一个例子:

\begin{tikzpicture}
%辅助网格
\draw  [dashed,step=1](0,0)grid(2,2);
%标注一个圆点,inner sep表示园内文字和边界的空白
\node [circle,fill=red,inner sep=2pt,label=above:$(1\text{,}2)$] (A) at
(1,2) {$A$};
%标注一个矩形,inner sep表示园内文字和边界的空白
\node [rectangle,fill=blue,inner sep=3pt,label=below:$(0\text{,}0)$] (O) at
(0,0) {$o$};
%标注一个圆角矩形,inner sep表示园内文字和边界的空白
\node [rectangle,rounded corners=1mm,fill=blue,inner sep=4pt,label=135:$(1\text{,}1)$] (B) at
(1,1) {$B$};
\end{tikzpicture}
图形如下:


你可能感兴趣的:(Latex,PGF_tikz)