如何在 Latex 中绘制这个矢量图?

如何在 Latex 中绘制这个矢量图?

在此处输入图片描述

我尝试了 tikzpicture,但是箭头太细了。另外,我不知道如何绘制坐标系,并将标签放在箭头末尾。

\begin{tikzpicture}

    \draw[->, ultra thick, blue,  arrows={-latex}]  (0,0) -- (1,1) node[sloped,midway,above=-0.1cm] {$\mathsf{v}$};

\end{tikzpicture}

答案1

\documentclass{article}
\usepackage{tikz}
\usepackage{amsmath}
\begin{document}
\begin{tikzpicture}
  \draw[thin,gray!40] (-2,-2) grid (2,2);
  \draw[<->] (-2,0)--(2,0) node[right]{$x$};
  \draw[<->] (0,-2)--(0,2) node[above]{$y$};
  \draw[line width=2pt,blue,-stealth](0,0)--(1,1) node[anchor=south west]{$\boldsymbol{u}$};
  \draw[line width=2pt,red,-stealth](0,0)--(-1,-1) node[anchor=north east]{$\boldsymbol{-u}$};
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

另一个简单的解决方案是(如果您使用MiKTeX、TeX Live 和 MacTeX的开关pstricks,则可以编译):pdflatex--enable-write18-shell-escape

\documentclass[svgnames, border=3pt]{standalone}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{pst-plot}
\usepackage{auto-pst-pdf}


\begin{document}

\psset{arrowinset=0.12, labels = none, ticks=none, fillstyle=solid}
\begin{pspicture}%
\psgrid[gridlabels=0pt, gridwidth=0.3pt, gridcolor=LightSteelBlue, subgriddiv=1, subgridwidth=0pt](-2,-2)(2,2)
    \psaxes[arrows=<->] (0,0)(-2,-2)(2,2)
\psset{arrows=->}
\psline[linecolor=SteelBlue, linewidth=1.8pt](0,0)(1,1)
\uput[r](1,1){$\color{SteelBlue}\mathbf{u}$}
\psline[linecolor=IndianRed, linewidth=1.8pt](0,0)(-1,-1)
\uput[l](-1,-1){$\color{IndianRed}\mathbf{-u}$}
\end{pspicture}

\end{document}

在此处输入图片描述

相关内容