自用的tikz代码

\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}

相机标定用的棋盘格(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}

在这里插入图片描述

线段标注

\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}

在这里插入图片描述

框图

\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}

综合

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}

在这里插入图片描述

角度

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}

函数

\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}

其他

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值