答案1
可能有点晚了,但这里有一个迷你教程给你。一些提示和评论。
1. 开始
嗯,它只是画出两个向量。很简单...
2. 第一次细化
添加一些样式,即覆盖标准箭头,并v2
为您的第二个矢量定义。例如,如果您想更改其颜色、虚线图案等,只需在此处更改样式(这与重复部分更相关,见下文)。
3. 添加参考坐标系
相当简单。请观看使用和更改样式的各种方法。
\draw[cs] (-2, 0) -- (3,0);
只需使用cs
\draw[->] (0, 0) -- (2,-1);
放箭头\draw[->,v2] (2,-1) -- (0, 3);
v2
相同且同时使用风格
4. 细化标签,添加曲折
如果您一直关注到现在,那么这里就没有什么惊喜了,只有更多您想要显示的内容。
5.添加注释
最后添加注释。这个有点棘手,原因如下:
- 我手动将两个节点与文本放在一起;通常你会将它与之前绘制的路径之一联系起来
- 您可以在节点文本中以数学模式输入文本
- 如果你使用 ams 包,你也可以进入矩阵环境,在这里我只是用转置向量来欺骗
- 您可以旋转节点,但是,如上所述,放置需要通过这种方式进行反复试验
- 为此,请注意所使用的极坐标
(50:3.5)
,即逆时针 50 度,距离中心 (0,0) 3.5 厘米,相对于节点中心(!) - 有几种方法可以引入旋转括号,我在这里省略了
% ~~~ standalone: good for development; loads tikz already as stated ~~~
\documentclass[10pt,border=3mm,tikz]{standalone}
\usetikzlibrary{arrows.meta}% provides nicer arrow-tips
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\begin{document}
% ~~~ 1. starting out ~~~~~~~~~~~~~~~~~~~~
\begin{tikzpicture}
\draw[->] (0,0) -- (2,-1);
\draw[->] (2,-1) -- (0,3);
\end{tikzpicture}
% ~~~ 2. 1st refinement ~~~~~~~~~~~~~~~~~~~~
\begin{tikzpicture}[
>={Stealth},% changing arrow tips
v2/.style={dashed},% defining a style for the snd vector
]
\draw[->] (0,0) -- (2,-1);
\draw[->,v2] (2,-1) -- (0,3);
\end{tikzpicture}
% ~~~ 3. adding a coordinate system for reference ~~~~~~~~~~~~~~~~~~~~
\begin{tikzpicture}[
>={Stealth},% changing arrow tips
v2/.style={dashed},% defining a style for the snd vector
cs/.style={black!50},% styling the coordinate system
]
% ~~~ coordinate system ~~~~~~~~ % <<< NEW
\draw[cs] (-2, 0) -- (3,0);
\draw[cs] ( 0,-2) -- (0,4);
% putting some labels
\node at (0,-1) {-1};
\node at (0, 3) { 3};
\node at (2, 0) { 2};
% ~~~ vectors ~~~~~~~~~~~~~~~
\draw[->] (0, 0) -- (2,-1);
\draw[->,v2] (2,-1) -- (0, 3);
\end{tikzpicture}
% ~~~ 4. refining labels, adding meander ~~~~~~~~~~~~~~~~~~~~
\begin{tikzpicture}[
>={Stealth},% changing arrow tips
v2/.style={dashed},% defining a style for the snd vector
cs/.style={black!50},% styling the coordinate system
ly/.style={xshift=-2mm},% shifting labels at y-axis
lx/.style={yshift=-2mm},% same for x-axis
me/.style={dotted},% styling the meandering path
]
% ~~~ coordinate system ~~~~~~~~
\draw[cs] (-2, 0) -- (3,0);
\draw[cs] ( 0,-2) -- (0,4);
% putting some labels
\node[ly] at (0,-1) {-1};
\node[ly] at (0, 3) { 3};
\node[lx] at (2, 0) { 2};
% ~~~ meander ~~~~~~~~~~~~ % <<< NEW
\draw[me] (2,-1) -- (1,-1) -- (1,1) -- (0,1);
% and some labels there
\node[lx,blue] at (1.5,-1) {-1};
\node[lx,blue] at (0.5,+1) {-1};
\node[ly,red] at (.9,.3) {+2};
% ~~~ vectors ~~~~~~~~~~~~~~~
\draw[->] (0, 0) -- (2,-1);
\draw[->,v2] (2,-1) -- (0, 3);
\end{tikzpicture}
% ~~~ 5. adding notes ~~~~~~~~~~~~~~~~~~~~
\begin{tikzpicture}[
>={Stealth},% changing arrow tips
v2/.style={dashed},% defining a style for the snd vector
cs/.style={black!50},% styling the coordinate system
ly/.style={xshift=-2mm},% shifting labels at y-axis
lx/.style={yshift=-2mm},% same for x-axis
me/.style={dotted},% styling the meandering path
]
% ~~~ coordinate system ~~~~~~~~
\draw[cs] (-2, 0) -- (3,0);
\draw[cs] ( 0,-2) -- (0,4);
% putting some labels
\node[ly] at (0,-1) {-1};
\node[ly] at (0, 3) { 3};
\node[lx] at (2, 0) { 2};
% ~~~ meander ~~~~~~~~~~~~
\draw[me] (2,-1) -- (1,-1) -- (1,1) -- (0,1);
% and some labels there
\node[lx,blue] at (1.5,-1) {-1};
\node[lx,blue] at (0.5,+1) {-1};
\node[ly,red] at (.9,.3) {+2};
% ~~~ vectors ~~~~~~~~~~~~~~~
\draw[->] (0, 0) -- (2,-1);
\draw[->,v2] (2,-1) -- (0, 3);
% ~~~ notes ~~~~~~~~~~~~~~~~~~~ % <<< NEW
\node at (3.5,-1.5) {$col_1 = [2, -1]^T$};
\node[rotate=30] at (50:3.5) {some part of $col_2$};
\end{tikzpicture}
\end{document}
答案2
如果你想要一个非 LaTeX 解决方案,我建议你用以下方式绘制图像Inkscape。如果您愿意,您可以将它们导出为 PDF,以作为浮点数包含在 LaTeX 文档中。