所以我这里有这段代码,
\begin{tikzpicture}
% Draw the axes
\draw [->,black] (-1.5,0) -- (3,0) ;
\draw [->,black] (0,-1.5) -- (0,3) ;
% Draw the line
\draw[-,black](0,0)--(3,2);
% Draw the circle
\path [draw,green] (+1.5,0) circle (1.5);
\path [draw,cyan] (0,1.5) circle (1.5);
% Intersection of circle and line
\draw[dashed,cyan](0,0.93)--(1.38,0.93);
\draw[dashed,cyan](1.38,0.93)--(1.38,0);
\draw[dashed,green](0,1.38)--(2.1,1.38);
\draw[dashed,green](2.1,0)--(2.1,1.38);
% \node[] at (-0.25,1.78){$y$};
\node[] at (-0.25,0.93){$y_3$};
\node[] at (1.38,-0.25){$x_3$};
\coordinate (a) at (0,0);
\coordinate (b) at (1.38,0.93);
\draw[decorate,decoration={brace,amplitude=5pt,raise=1pt,mirror},yshift=0pt] (a) -- (b) node [midway,yshift=-10pt, xshift = 10pt]{$|z_3|$};
\node[] at (-0.25,1.38){$y_2$};
\node[] at (2.1,-0.25){$x_2$};
% \node[] at (2.9,-0.25) {$x$};
% Draw the angle
\draw [red] (0,0.3) arc (90:33:0.3);
\draw[red] (0,0.4)arc(90:33:0.4);
\node[] at (60:.6) {$\alpha$};
% Done
\end{tikzpicture}
,得到以下图像:
但是,我想做的是在图片所示的部分上制作支架/标记。(我手绘的位置很清楚)。
我该如何修改上述内容才能做到这一点?
答案1
对于括号,您可以使用装饰brace
。您可以使用intersections
库来计算线和圆之间的交点;这样,您就不必手动计算坐标;我还将字体大小缩小为\scriptsize
:
\documentclass{article}
\usepackage{tikz}% just for the example
\usetikzlibrary{decorations.pathreplacing,intersections}
\begin{document}
\begin{tikzpicture}[every node/.append style={font=\scriptsize}]
% Draw the axes
\draw [->,black] (-1.5,0) -- (3,0) ;
\draw [->,black] (0,-1.5) -- (0,3) ;
% Draw the line
\path[name path=line,draw,-] (0,0) -- (3,2);
% Draw the circle
\path [name path=greencircle,draw,green] (+1.5,0) circle (1.5);
\path [name path=bluecircle,draw,cyan] (0,1.5) circle (1.5);
% find intersections of line and circles
\path[name intersections={of=line and bluecircle, by={a,b}}];
\path[name intersections={of=line and greencircle, by={c,d}}];
% lines from axes to intersection points
\draw[dashed,cyan] (0,0|-b) -- (b);
\draw[dashed,cyan] (b|-0,0) -- (b);
\draw[dashed,green] (0,0|-c) -- (c);
\draw[dashed,green] (c|-0,0) -- (c);;
% \node[] at (-0.25,1.78){$y$};
\node[left] at (0,0|-b) {$y_3$};
\node[below] at (b|-0,0) {$x_3$};
\node[left] at (0,0|-c) {$y_2$};
\node[below] at (c|-0,0) {$x_2$};
\coordinate (O) at (0,0);
% draw braces
\draw[decorate,decoration={brace,amplitude=5pt,raise=0.5pt,mirror},yshift=0pt] (O) -- (b) node [midway,yshift=-9pt, xshift =6pt]{$|z_3|$};
\draw[decorate,decoration={brace,amplitude=5pt,raise=0.5pt},yshift=0pt] (O) -- (c) node [midway,yshift=11pt, xshift =-5pt]{$|z_2|$};
% \node[] at (2.9,-0.25) {$x$};
% Draw the angle
\draw [red] (0,0.3) arc (90:33:0.3);
\draw[red] (0,0.4)arc(90:33:0.4);
\node[] at (60:.6) {$\alpha$};
% Done
\end{tikzpicture}
\end{document}