我怎样才能在 TikZ 上制作花括号来标记 x 和 y,就像这张图中一样?
答案1
您正在图书馆寻找一件brace
装饰品decorations.pathreplacing
:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,angles,quotes}
\begin{document}
\begin{tikzpicture}
\draw[->] (0,0) coordinate (O) -- (3,0);
\draw[->] (O) -- (0,4);
\node[inner sep=1.5pt,fill,circle,label={60:$(x,y)$}] at (2,3) (point) {};
\draw (0,0) -- (point);
\draw (1.8,0) -- ++(0,0.2) -- ++(0.2,0);
\draw[dashed] (2,0) coordinate (pointx) -- (point);
\draw[decoration={brace,mirror,raise=5pt},decorate]
(2,0) -- node[right=6pt] {$y$} (point);
\draw[decoration={brace,mirror,raise=5pt},decorate]
(0,0) -- node[below=6pt] {$x$} (2,0);
\path pic ["$\theta$", draw, ->] {angle=pointx--O--point};
\end{tikzpicture}
\end{document}