我在同一张图中绘制了两组点。我想用大括号标记它们分组,用大括号标记欠焊或过焊,正如我在此处手工说明的那样:
我正在寻找与数学格式相同类型的钎焊,其中 $$\underbrace{a+b+c}_n$$:
A测试工作代码是:
\documentclass{article}
\usepackage{pgfplots}
\usepackage{xcolor}
\begin{document}
\begin{tikzpicture}
\pgfplotsset{height=7cm, width=8.5cm}
\begin{axis}[
axis lines = left,
hide x axis,
xmin=0, xmax=8,
ymin=600,ymax=1000
]
\addplot[only marks,orange] coordinates {
(1,700)
(2,700)
(3,700)
(4,700)
(5,700)
};
\end{axis}
\begin{axis}[
hide x axis,
hide y axis,
ymin=600,ymax=1000,
xmin=0, xmax=8
]
\addplot[only marks,blue] coordinates {
(6,900)
(7,900)
};
\node at (axis cs:1, 725) {1};
\node at (axis cs:2, 725) {2};
\node at (axis cs:3, 725) {3};
\node at (axis cs:4, 725) {4};
\node at (axis cs:5, 725) {5};
\node at (axis cs:6, 925) {6};
\node at (axis cs:7, 925) {7};
\end{axis}
\end{tikzpicture}
\end{document}
答案1
您可以使用它在两点之间decorations={brace}
创建一个支架。tikz
我用 等定义了所需的节点A
,B
以便重复使用这些位置。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
\usepackage{pgfplots}
\usepackage{xcolor}
\begin{document}
\begin{tikzpicture}
\pgfplotsset{height=7cm, width=8.5cm}
\begin{axis}[
axis lines = left,
hide x axis,
xmin=0, xmax=8,
ymin=600,ymax=1000
]
\addplot[only marks,orange] coordinates {
(1,700)
(2,700)
(3,700)
(4,700)
(5,700)
};
\end{axis}
\begin{axis}[
hide x axis,
hide y axis,
ymin=600,ymax=1000,
xmin=0, xmax=8
]
\addplot[only marks,blue] coordinates {
(6,900)
(7,900)
};
\node (A) at (axis cs:1, 725) {1};
\node at (axis cs:2, 725) {2};
\node at (axis cs:3, 725) {3};
\node at (axis cs:4, 725) {4};
\node (B) at (axis cs:5, 725) {5};
\node (C) at (axis cs:6, 925) {6};
\node (D) at (axis cs:7, 925) {7};
\draw [decorate,decoration={brace,amplitude=10pt,mirror,raise=6mm}]
(A.west) -- (B.east) node [black,midway, below, yshift=-10mm] {a};
\draw [decorate,decoration={brace,amplitude=5pt,mirror,raise=6mm}]
(C.west) -- (D.east) node [black,midway, below, yshift=-10mm] {b};
\end{axis}
\end{tikzpicture}
\end{document}