tikz-坐标平移

来源:互联网 发布:文件服务器监控软件 编辑:程序博客网 时间:2024/05/18 21:46

关键字:xshift,yshift,shift

要点:
- 如果xshift或yshift的偏移量值为0,则可以省略。
- 如果x或y方向上某个值为0,则shift可以用更易读的xshift或yshift代替。
- shfit后面的参数要用花括号括起来

这里以正六边形为例,代码:

\begin{tikzpicture}[scale=1]\coordinate (P1) at (1,0);\coordinate (P2) at ([shift={+(120:1cm)}] P1);\coordinate (P3) at ([shift={+(-1,0)}] P2);\coordinate (P4) at ([shift={+(240:1cm)}] P3);\coordinate (P5) at ([shift={+(300:1cm)}] P4);\coordinate (P6) at ([xshift=1cm, yshift=0] P5);\draw (P1)node [right]{P1}      --(P2)node [above right]{P2}      --(P3)node [above left]{P3}      --(P4)node [left]{P4}      --(P5)node [below left]{P5}      --(P6)node [below right]{P6}      --cycle;\end{tikzpicture}

效果:

这里写图片描述

0 0
原创粉丝点击