![在一个 tikzpicture 框中绘制两条线](https://linux22.com/image/423290/%E5%9C%A8%E4%B8%80%E4%B8%AA%20tikzpicture%20%E6%A1%86%E4%B8%AD%E7%BB%98%E5%88%B6%E4%B8%A4%E6%9D%A1%E7%BA%BF.png)
你好我想画这个:
(字母和具体尺寸不重要)
我的代码是这样的,但它不起作用我想在这里混合这两行。
\subfigure
{
\begin{tikzpicture}[smooth,scale=0.8]
\draw[thick,->] (-2,0) -- (2,0) node[below] {$x$};
\draw[thick,->] (0,-1.5) -- (0,1.5) node[right] {$y$};
\draw[blue,thick,domain=0:1.5] plot (\x,{\x}) node[above]
\draw[blue,thick,domain=-1.5:0] plot (\x,{0}) node[above]
\end{tikzpicture}
}
\subfigure
谢谢你的帮助。
答案1
像这样?
\documentclass[tikz, border=3mm]{standalone}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}[%smooth,scale=0.8
> = Straight Barb,
dot/.style = {circle, draw, thick, fill=blue, inner sep=2pt,
label={[fill=white, inner sep=1pt, font=\small]60:#1},
node contents={},}
]
% axis
\draw[->] (-2.0,0) -- (2,0.0) node[below left] {$x$};
\draw[->] (0,-1.5) -- (0,1.5) node[below right] {$y$};
%
\draw[very thick]
(-1.5,0.0) node[dot=A] --
( 0.0,0.0) node[dot=B] --
( 1.5,1.5) node[dot=C];
\end{tikzpicture}
\end{document}