当前位置:   article > 正文

自用的tikz代码_\usetikzlibrary{quotes,angles}

\usetikzlibrary{quotes,angles}

\documentclass{standalone} 
\usepackage{tikz}
\usetikzlibrary{intersections} 
\usetikzlibrary{positioning,backgrounds} 
\begin{document}
\begin{tikzpicture}[scale=1.5,line width=0.75pt] %点A   
\coordinate (A) at (-1,0);   
\node[left] at (A) {$A$}; %点D   
\coordinate (D) at ([shift=(50:1.2cm)]A);   
\fill (D) circle (1pt) node[left] {$D$}; %点B   
\coordinate (B) at (1,0);   
\node[right] at (B) {$B$}; %点C   
\coordinate (C) at ([shift=(110:1.2cm)]B);   
\fill (C) circle (1pt) node[right] {$C$};   
\path [name path =AD] (A)--++(50:2.5);   
\path [name path =BC] (B)--++(110:2.5);   
\fill [name intersections={of=AD and BC, by={F}}]  (F) circle(1pt) node [above] {$F$};   
\draw[dashed] (F)--(D)(F)--(C);   
\draw (D)--(A)--(B)--(C); 
\end{tikzpicture} 
\end{document}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21

相机标定用的棋盘格(6x9)

\documentclass{article}
\usepackage{tikz}
\usepackage{geometry}
\geometry{a4paper,left=0cm,right=0cm,top=1cm,bottom=0cm}
\begin{document}
\newcommand{\chesswidth}{2.8}
\begin{tikzpicture}
\foreach \x in {0,1,2,3}
    \foreach \y in {0,1,2,3,4}
        \draw[fill=black] (\x*\chesswidth*2, \y*\chesswidth*2)rectangle(\x*\chesswidth*2+\chesswidth, \y*\chesswidth*2+\chesswidth);
\foreach \x in {1,2,3}
    \foreach \y in {1,2,3,4,5}
        \draw[fill=black] (\x*\chesswidth*2-\chesswidth, \y*\chesswidth*2-\chesswidth)rectangle(\x*\chesswidth*2, \y*\chesswidth*2);
\end{tikzpicture}
\end{document}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

在这里插入图片描述

线段标注

\documentclass{ctexart}
\usepackage{tikz}
\usetikzlibrary {graphs, positioning, calc, quotes, shapes.geometric, shapes.misc, backgrounds}
\begin{document}
\begin{tikzpicture}
\coordinate (a) at (1,0);
\coordinate (b) at (3,2);
\draw[->] (a) -- (b);
\draw($(a)!0.8!10:(b)$) node{A};
\end{tikzpicture}
\end{document}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

在这里插入图片描述

框图

\begin{tikzpicture}[node distance=10mm]
    \tikzstyle{styinout}=[draw, rectangle, minimum width=10mm, minimum height=5mm, rounded corners=2.5mm]
    \tikzstyle{styrect}=[draw, minimum width=10mm, minimum height=10mm]
    \tikzstyle{stygain}=[draw, isosceles triangle]
    \tikzstyle{stycircle}=[draw, circle]
    \node[styinout] (mdin1) {I};
	\node[stycircle, right=of mdin1] (mdsum1) {};
	\node[stygain, right=of mdsum1] (mdgain1) {};
	\node[styrect, right=of mdgain1] (mdint1) {$\displaystyle\frac{1}{s}$};
	\node[styinout, right=of mdint1] (mdout1) {O};
	\graph{
        (mdin1)->(mdsum1)->(mdgain1)->(mdint1)->(mdout1)
	};
	\draw [->] ($(mdint1.east)+(0.5,0)$) -- ++(0,-1) -| (mdsum1);
	% \draw [->] ($(mdint1.east)+(0.5,0)$) -- ++(0,-.5) -| (mdsum1) --node[below]{$-$}+(1mm,-1mm);

\end{tikzpicture}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

综合

3.TikZ画角度标注、大括号、垂线

\documentclass[10pt]{standalone}
\usepackage{tikz} 
\usetikzlibrary{quotes,angles}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}
%定义坐标
\coordinate (o) at (0,0);
\coordinate (a) at (30:3);
\coordinate (b) at (70:3);
\coordinate (c) at (0:3);
%画x和y轴坐标
\draw[<->](3.2,0)--(o)--(0,3.2);
%画刻度
\foreach \x in {1,2,3}
{
    \draw[xshift=\x cm] (0,0) -- (0,0.1);
    \draw[yshift=\x cm] (0,0) -- (0.1,0);
    \node[below] at (\x,0){\x};
    \node[left] at (0,\x){\x}; 
};  
%画直线
\draw[<->](a)node[right]{A}--(o)node[below]{O}--(b)node[right]{B};
%画弧
\pic["$\alpha$", draw=green!40, <->, angle eccentricity=0.6, angle radius=0.7cm]
    {angle=c--o--a};%\alpha的位置由eccentricity决定。
\pic["$\beta$", draw=orange!40, <->, angle eccentricity=1.1, angle radius=1.8cm]
    {angle=a--o--b};
\pic["$\gamma$", draw=blue!40, <->, angle eccentricity=1.1, angle radius=2.3cm]
    {angle=c--o--b};   
 
%B点垂线和大括号
\draw[blue,dotted] (b) -- ($(o)!(b)!(c)$);
\draw[decorate,decoration={brace,raise=8pt},red!50] (b) -- ($(o)!(b)!(c)$);
%C点垂线
\draw[blue,dotted] (a) -- ($(o)!(a)!(c)$);
\draw[decorate,decoration={brace,raise=8pt,amplitude=0.4cm},red!50] (a) -- ($(o)!(a)!(c)$);  
\draw[decorate,decoration={brace,raise=8pt,amplitude=0.2cm},violet!50] (a) -- ($(o)!(a)!(c)$)node[black,midway,xshift=1.3cm]{$\triangle ABC$};   
\end{tikzpicture}
\end{document}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41

在这里插入图片描述

角度

tikz任意角度画法

\documentclass[tikz,border=10pt]{standalone}
\usepackage{verbatim}
\usetikzlibrary{quotes,angles}
\begin{document}
\begin{tikzpicture}
  \draw
    (3,-1) coordinate (a) node[right] {a}
    -- (0,0) coordinate (b) node[left] {b}
    -- (2,2) coordinate (c) node[above right] {c}
    pic["$\alpha$", draw=orange, <->, angle eccentricity=1.2, angle radius=1cm]
    {angle=a--b--c};
\end{tikzpicture}
\end{document}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

函数

\documentclass{article}
\usepackage{tkz-fct}
\begin{document}
\begin{tikzpicture}[scale=1.5]
    \tkzInit[xmin=-20,xmax=20,xstep=10,ymin=-0.2,ymax=1.2]
    \tkzGrid
    \tkzFctPar[samples=400,domain=-17:17]{t}{abs(sin(t)/t)}
    \end{tikzpicture}
\end{document}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

其他

用tikz画球坐标系下的体积微元
tikz制图简要教程

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/AllinToyou/article/detail/238061
推荐阅读
相关标签
  

闽ICP备14008679号