LaTex 矢量绘图之 Tikz 代码示例汇总

2024-01-27 05:28

本文主要是介绍LaTex 矢量绘图之 Tikz 代码示例汇总,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

1,代码

\documentclass[]{article}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}\begin{tikzpicture} 
\draw (0,0) -- (1,1);%hello
\end{tikzpicture}\begin{tikzpicture} \draw[step=1,color=gray!40] (-2,-2) grid (2,2); \draw[->] (-3,0) -- (3,0); \draw[->] (0,-3) -- (0,3); \draw (0,0) circle (1);  
\end{tikzpicture} \begin{tikzpicture} \draw[help lines] ( -5,-5 ) grid ( 5, 5); 
\end{tikzpicture}\begin{tikzpicture} \draw[help lines] ( -5,-5 ) grid ( 5, 5); \draw[red] (-3,0) -- (3,0); \draw[red] (0,-3) -- (0,3); \end{tikzpicture}hello\\\begin{tikzpicture} \draw[->] (-3,3) -- (3,3); \draw[->>] (-3,2) -- (3,2); \draw[->|] (-3,1) -- (3,1); \draw[-to] (-3,0) -- (3,0); \draw[-latex] (-3,-1) -- (3,-1); \draw[-stealth] (-3,-2) -- (3,-2); \end{tikzpicture}\begin{tikzpicture} \draw[step=1,color=gray!40] (-2,-2) grid (2,2); \draw[->] (-3,0) -- (3,0); \draw[->] (0,-3) -- (0,3); \draw (0,0) circle (1);  \end{tikzpicture}\begin{tikzpicture} \draw[step=1,color=gray!40] (-2,-2) grid (2,2); \draw[->] (-3,0) -- (3,0); \draw[->] (0,-3) -- (0,3); \draw (0,0) ellipse (1 and 0.5); \end{tikzpicture}\begin{tikzpicture}\draw[step=1,color=gray!40] (-2,-2) grid (2,2);\draw[->] (-3,0) -- (3,0);\draw[->] (0,-3) -- (0,3);\draw[color=gray!40] (0,0) circle (1); %\draw[color=red] (1,0) arc (0:45:1);\draw[color=gray!40] (0,0) ellipse (1 and 0.5);\draw[color=green] (1,0) arc (0:60:1 and 0.5);\end{tikzpicture}\begin{tikzpicture}[scale=2]\draw[step=1,color=gray!40] (-2,-2) grid (2,2);\draw[color=red] (-1,-1) rectangle (1,1);\end{tikzpicture}hello\\\\\\\begin{tikzpicture}\draw[step=1,color=gray!40] (-2,-2) grid (2,2);\path (1,1) coordinate (p1);\coordinate (p2) at ( 2, 0);\draw[dotted, red] (p1) -- (p2)  ;\end{tikzpicture}\begin{tikzpicture}[scale=2]\draw[step=1,color=gray!40] (-2,-2) grid (2,2);\draw[latex-latex, red] (0,-2) -- ++(-1,1) -- ++(-1,-1);\draw[dashed, blue] (0,1) -- +(-1,1) -- +(-2,0);\end{tikzpicture}               
\\\\\\\\testtt\\\\\\\\\begin{tikzpicture} \node (node001) at (0,2) [draw] {test}; \end{tikzpicture}\begin{tikzpicture} \node (node001) at (0,2) [draw] {node001}; \node (node002) at (-2,0) [draw] {node002}; \node (node003) at (2,0) [draw] {node003}; \draw (node cs:name=node003,anchor=north) |- (0,1); \draw (node002.north) |- (0,1) -| (node cs:name=node001,anchor=south); \end{tikzpicture}
\\\\good    testtt\\\\\\\\\begin{tikzpicture} \node (p1) at (30:1) {$p_1$} ; \node (p2) at (75:1) {$p_2$} ; \draw (-0.2,0) -- (1.2,0) node[right] (xline) {$q_1$}; \draw (2,-0.2) -- (2,1.2) node[above] (yline) {$q_2$}; \draw[->] (p1) -- (p1 |- xline); \end{tikzpicture}\begin{tikzpicture} \node (p1) at (30:1) {$p_1$} ; \node (p2) at (75:1) {$p_2$} ; \draw (-0.2,0) -- (1.2,0) node[right] (xline) {$q_1$}; \draw (2,-0.2) -- (2,1.2) node[above] (yline) {$q_2$}; \draw[->] (p1) -- (p1 |- xline); \end{tikzpicture}
\\\\hello\\\\\begin{tikzpicture} \draw [ultra thick] (0,1) -- (2,1); \draw [thick] (0,0.5) -- (2,0.5); \draw [thin] (0,0) -- (2,0); \end{tikzpicture}
\\\\hello\\\\\\\\\begin{tikzpicture} \draw [line width=0.4pt] (0,0) -- (2,0); \draw[red]  (0,1) -- (2,1); \draw [line width=0.2cm] (4,.75) -- (5,.25); \end{tikzpicture}
\\\\hello\\\\\\\\\begin{tikzpicture}[scale=3] \draw[help lines] (0,0) grid (2,2); \draw[color=red] (0,0) .. controls (1,1) and (2,1) .. (2,0); \shade[ball color=gray!10] (0,0) circle (0.1); \shade[ball color=gray!40] (1,1) circle (0.1); \shade[ball color=gray!70] (2,1) circle (0.1); \shade[ball color=gray] (2,0) circle (0.1); \end{tikzpicture}\begin{tikzpicture} \shade[ball color=red] (1,2) circle (1); \end{tikzpicture}
\\\\hello\\\\\\\\
\begin{tikzpicture}[outline/.style={draw=#1,thick,fill=#1!50},outline/.default=black]\node [outline]at (0,1) {default};\node [outline=blue] at (0,0) {blue};\end{tikzpicture}
\\\\hello\\\\\\\\
\usetikzlibrary{positioning}
\tikzset{place/.style={circle,draw=blue!50,fill=blue!20,
thick,inner sep=0pt,minimum size=6mm}}
\tikzset{transition/.style={rectangle,draw=black!50,
fill=black!20,thick,inner sep=0pt,minimum size=4mm}}
\tikzset{every label/.style=red}
\begin{tikzpicture}[bend angle=45]
\node[place] (waiting)  {};
\node[place] (critical) [below=of waiting] {};
\node[place](semaphore) [below=of critical,label=above:$s\le3$] {};
\node[transition](leave critical) [right=of critical]{};
\node[transition] (enter critical)[left=of critical]{};
\draw [->] (enter critical) to (critical);
\draw [->] (waiting) to [bend right] (enter critical);
\draw [->] (enter critical) to [bend right] (semaphore);
\draw [->] (semaphore) to [bend right] (leave critical);
\draw [->] (critical) to (leave critical);
\draw [->] (leave critical) to [bend right] (waiting);
\end{tikzpicture}
\\\\hello\\\\\\\\
\begin{tikzpicture}\draw[help lines] (0,0) grid (3,2);\foreach \x in {0,1,...,4}\draw[xshift=\x cm] (0,-1) -- (0,1);\end{tikzpicture}
\\\\hello\\\\\\\\
\begin{tikzpicture} \draw[help lines] (0,0) grid (3,2); \draw (0,0) -- (1,1); \draw[red] (0,0) -- ([xshift=1cm] 1,1); \end{tikzpicture}
\\\\hello\\\\\\\\
\begin{tikzpicture} \draw (0,0)[rotate=30]  ellipse (2 and 1); \end{tikzpicture}
\\\\hello\\\\\\\\
\begin{tikzpicture} 
\begin{axis} 
\addplot{x*2}; 
\end{axis} 
\end{tikzpicture}
\\\\hello\\\\\\\\
\begin{tikzpicture}\begin{axis} \addplot coordinates  {(0,0) (1,1) (2,3) (3,9)}; \end{axis}\end{tikzpicture}
\\\\hello\\\\\\\\
\\\\hello\\\\\\\\
\\\\hello\\\\\\\\
\\\\hello\\\\\\\\
\\\\hello\\\\\\\\
\\\\hello\\\\\\\\
\\\\hello\\\\\\\\
\\\\hello\\\\\\\\
\\\\hello\\\\\\\\\end{document}

2,效果示例

这篇关于LaTex 矢量绘图之 Tikz 代码示例汇总的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/649176

相关文章

Python位移操作和位运算的实现示例

《Python位移操作和位运算的实现示例》本文主要介绍了Python位移操作和位运算的实现示例,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一... 目录1. 位移操作1.1 左移操作 (<<)1.2 右移操作 (>>)注意事项:2. 位运算2.1

使用Python实现矢量路径的压缩、解压与可视化

《使用Python实现矢量路径的压缩、解压与可视化》在图形设计和Web开发中,矢量路径数据的高效存储与传输至关重要,本文将通过一个Python示例,展示如何将复杂的矢量路径命令序列压缩为JSON格式,... 目录引言核心功能概述1. 路径命令解析2. 路径数据压缩3. 路径数据解压4. 可视化代码实现详解1

python获取网页表格的多种方法汇总

《python获取网页表格的多种方法汇总》我们在网页上看到很多的表格,如果要获取里面的数据或者转化成其他格式,就需要将表格获取下来并进行整理,在Python中,获取网页表格的方法有多种,下面就跟随小编... 目录1. 使用Pandas的read_html2. 使用BeautifulSoup和pandas3.

pandas中位数填充空值的实现示例

《pandas中位数填充空值的实现示例》中位数填充是一种简单而有效的方法,用于填充数据集中缺失的值,本文就来介绍一下pandas中位数填充空值的实现,具有一定的参考价值,感兴趣的可以了解一下... 目录什么是中位数填充?为什么选择中位数填充?示例数据结果分析完整代码总结在数据分析和机器学习过程中,处理缺失数

Pandas统计每行数据中的空值的方法示例

《Pandas统计每行数据中的空值的方法示例》处理缺失数据(NaN值)是一个非常常见的问题,本文主要介绍了Pandas统计每行数据中的空值的方法示例,具有一定的参考价值,感兴趣的可以了解一下... 目录什么是空值?为什么要统计空值?准备工作创建示例数据统计每行空值数量进一步分析www.chinasem.cn处

Java对象转换的实现方式汇总

《Java对象转换的实现方式汇总》:本文主要介绍Java对象转换的多种实现方式,本文通过实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下吧... 目录Java对象转换的多种实现方式1. 手动映射(Manual Mapping)2. Builder模式3. 工具类辅助映

利用Python调试串口的示例代码

《利用Python调试串口的示例代码》在嵌入式开发、物联网设备调试过程中,串口通信是最基础的调试手段本文将带你用Python+ttkbootstrap打造一款高颜值、多功能的串口调试助手,需要的可以了... 目录概述:为什么需要专业的串口调试工具项目架构设计1.1 技术栈选型1.2 关键类说明1.3 线程模

Python Transformers库(NLP处理库)案例代码讲解

《PythonTransformers库(NLP处理库)案例代码讲解》本文介绍transformers库的全面讲解,包含基础知识、高级用法、案例代码及学习路径,内容经过组织,适合不同阶段的学习者,对... 目录一、基础知识1. Transformers 库简介2. 安装与环境配置3. 快速上手示例二、核心模

Python使用getopt处理命令行参数示例解析(最佳实践)

《Python使用getopt处理命令行参数示例解析(最佳实践)》getopt模块是Python标准库中一个简单但强大的命令行参数处理工具,它特别适合那些需要快速实现基本命令行参数解析的场景,或者需要... 目录为什么需要处理命令行参数?getopt模块基础实际应用示例与其他参数处理方式的比较常见问http

Java的栈与队列实现代码解析

《Java的栈与队列实现代码解析》栈是常见的线性数据结构,栈的特点是以先进后出的形式,后进先出,先进后出,分为栈底和栈顶,栈应用于内存的分配,表达式求值,存储临时的数据和方法的调用等,本文给大家介绍J... 目录栈的概念(Stack)栈的实现代码队列(Queue)模拟实现队列(双链表实现)循环队列(循环数组