1.TikZ 绘图坐标系
最编程
2024-03-31 07:53:01
...
1 绘制步骤
- 画两条坐标轴
- 添加坐标轴名称
- 添加原点
- 画刻度
2 绘制过程
\documentclass[10pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
%画x和y轴坐标
\draw[->] (-5.2,0)--(5.2,0);
\draw[->] (0,-5.2)--(0,5.2);
%画刻度
\foreach \x in {0,1,...,8}
{
\draw[xshift=\x cm] (-4,0) -- (-4,0.1);
\draw[yshift=\x cm] (0,-4) -- (0.1,-4);
};
%标坐标原点
\node[below] at (0.2,0){0};
%标x轴刻度值
\foreach \x in {-4,-3,...,-1}
\node[below] at(\x,0){\x};
\foreach \y in {1,2,...,4}
\node[below] at(\y,0){\y};
% 标注y轴刻度
\foreach \y in {-4,-3,...,-1}
\node[left] at(0,\y){\y};
\foreach \y in {1,2,...,4}
\node[left] at(0,\y){\y};
\end{tikzpicture}
\end{document}
3 结果
4 知识点
- foreach循环
for \x in {1,2,...,4}{
执行语句;
};
for 句子结尾要用分号。
- 直线平移命令
\draw[xshift=\x cm] (-4,0) -- (-4,0.1);
\draw[xshift=\x cm] (-4,0) -- (-4,0.1);
其中xshift和yshift分别表示左右平移和上下平移 。
tikz现在才明白它是用来画图的,他可以换各种各样的图,各种各样的几何图形他都可以画出来。
很长一段时间我都在寻找一个能够画几何图形的工具 tikz是其他工具中最好的。python也是可以画几何图形的,但从美观来看,不如tikz。python主要是用来处理数据,而不是画图。
5 参考网站
https://www.overleaf.com/learn/latex/LaTeX_Graphics_using_TikZ:A_Tutorial_for_Beginners(Part_1)%E2%80%94Basic_Drawing
上一篇: PyAutoGUI - 图形用户界面自动化(超级详细)
下一篇: Linux 初级 (XI) 中间件
推荐阅读
-
绘制米老鼠_简单可爱的米老鼠像素画网格绘图图案
-
介绍并使用 plt.plot 进行 Python 折线绘图
-
11 [PS Blender 绘图] 场景绘制景深
-
Openpyxl 3.0 官方文档 (20) - 更改绘图区域和图例布局 - 图表布局*
-
[计算机绘图]绘制填充模型:重心坐标、Z 缓冲区
-
AI 绘图:稳定的扩散 ComfyUI 本地重绘和智能扩展综合教程
-
绘图--分析几种较为复杂的统计图的实施情况
-
使用画布和路径制作 Android 自定义绘图动画
-
解决图解现在默认显示在 "绘图 "窗格中。要使它们在控制台中也以内联方式显示--解决运行错误
-
R 中的统计和绘图:可视化 ROC 曲线的置信区间