答案1
您可以从类似这样的内容开始,然后根据需要添加更多样式。
\documentclass[tikz,border=5pt]{standalone}
\begin{document}
\begin{tikzpicture} [thick]
\draw [<->] (0,4)node[left]{$y$}--(0,0)--(5,0)node[below]{$x$};
\draw [dashed] (0,2.5) -- (3.5,2.5)node[above right]{$z=(x,y)$} -- (3.5,0);
\draw [red] (0,0)--node[above=.5em]{\color{black}$|z|$}(3.5,2.5);
\end{tikzpicture}
\end{document}
答案2
欢迎来到 TeX.SE!
还有另外一种稍微复杂一点的可能性:
\documentclass[tikz,border=5pt]{standalone}
\usetikzlibrary{arrows.meta,
quotes}
\begin{document}
\begin{tikzpicture}[> = Straight Barb]
\draw [<->] (0,4) node[below left]{$y$} |- (5,0) node[below left]{$x$};
\draw [dashed] (3.5, 0) node[below] {$x_i$} --
(3.5,2.5) coordinate[label=45:{$z=(x_i,y_j)$}] (v) --
(0, 2.5) node[left] {$y_j$};
\path [draw=red, thick] (0,0) to ["$|z|$" sloped] (v);
\end{tikzpicture}
\end{document}