我正在使用 beamer 模板进行演示。我想要一个坐标系统,其中有一个从左上角到右下角的平滑弧作为帕累托前沿。在这个弧上,我希望节点均匀分布。目前,我有一个 foreach 来获取一条线上的节点并在其后面绘制弧?我怎样才能将节点精确地放在那条弧上?我还需要这些节点一个接一个地出现。
这是我目前所拥有的。
\begin{tikzpicture}[anchor=mid west, mark size=+4pt, ball color=black!80]
% \draw [lightgray, thin] (0,0) grid (6,6);
\pause
\draw [latex-latex,thick] (0,6)
-- (0,0) node[rotate=90, midway, above, align=center] {Performance}
-- (6,0) node[ midway, below, align=center] {Ease of Resuasability};
\onslide<7->{\draw [draw=black!60] (0.5,5.5) to[out=-20, in=110] (5.5,0.5);}
\pause
\foreach \impl[count=\cnt] in {Generic C, Field Specific C, CPU Specific, Hand Tuned Assembly} {
\draw[mark options={fill=red}]
plot[mark=ball] coordinates {(6.5-\cnt*1.4, 1.4*\cnt-0.5)} node[fill=white,xshift=.5em] {\impl};
\pause
}
\pause
\node [single arrow, rotate=45, fill=white, draw=blue] at (4,4) {\quad\quad\quad};
\onslide<1-> %% workaround to have the footline
\end{tikzpicture}
我尝试使用“情节”
\draw[color=blue] plot[smooth, tension=1, mark=ball, mark indices={1,2}] coordinates {(0.5, 5.5) (6, 4) (9.5, 0.5)};
这给了我一个漂亮的弧,但我不想指定此图上的所有其他节点,更不用说坐标了。我也不知道在哪里添加 es \pause
。
答案1
您可以通过 沿路径放置坐标pos
。
\documentclass{beamer}
\usepackage{tikz}
\begin{document}
\begin{frame}[t]
\frametitle{Arc with coordinates}
\begin{tikzpicture}[anchor=mid west, mark size=+4pt, ball color=black!80]
% \draw [lightgray, thin] (0,0) grid (6,6);
\pause
\draw [latex-latex,thick] (0,6)
-- (0,0) node[rotate=90, midway, above, align=center] {Performance}
-- (6,0) node[ midway, below, align=center] {Ease of Resuasability};
\draw [draw=black!60] (0.5,5.5) to[out=-20, in=110]
coordinate[pos=1/5] (p-1) coordinate[pos=2/5] (p-2)
coordinate[pos=3/5] (p-3) coordinate[pos=4/5] (p-4)
(5.5,0.5);
\pause
\foreach \impl[count=\cnt] in {Generic C, Field Specific C, CPU Specific, Hand Tuned Assembly} {
\draw[mark options={fill=red}]
plot[mark=ball] coordinates {(p-\cnt)} node[right=.5em] {\impl};
\pause
}
\end{tikzpicture}
\end{frame}
\end{document}
答案2
- 如果您能提供 MWE,那么我们将更容易为您提供帮助......
- 图像元素如何显示还不完全清楚
- 看看,如果以下解决方案是你想要的)我从头开始重写了你的代码片段......)
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
backgrounds,
shapes.arrows}
\begin{document}
\begin{frame}[fragile] % needed because of dot style definition
\frametitle{Frame title}
\begin{tikzpicture}[
dot/.style = {circle, ball color=blue!80,
label=right:#1
},
lbl/.style = {auto=right, sloped},
SA/.style = {single arrow, draw=blue, thick,
minimum height=6em,
anchor=tail, rotate=45}
]
\draw [Latex-Latex,thick]
(0,6) -- node[lbl] {Performance} (0,0)
-- node[lbl] {Ease of Resuasability} (6,0);
\foreach \impl [count=\cnt,
count=\sld from 2] in {Generic C,
Field Specific C,
CPU Specific,
Hand Tuned Assembly}
{
\onslide<\sld->{
\node[dot=\impl] at (\cnt*90/5:5) {};
}
}
\scoped[on background layer]
{
\onslide<6->{\draw[semithick] (10:5) arc(10:80:5);}
\onslide<7->{\node [SA] at (45:5.5) {};}
}
\end{tikzpicture}
\end{frame}
\end{document}
第一张幻灯片:
第三张幻灯片:
最后一张幻灯片之前: