移动/定位 tikz \根据节点绘制图?

移动/定位 tikz \根据节点绘制图?

使用此 MWE:

\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{fit,calc}
\makeatletter
\tikzset{
  % http://tex.stackexchange.com/questions/47704/how-to-establish-node-anchor
  fitting node/.style={
    inner sep=0pt,
    fill=none,
    draw=none,
    reset transform,
    fit={(\pgf@pathminx,\pgf@pathminy) (\pgf@pathmaxx,\pgf@pathmaxy)}
  },
  reset transform/.code={\pgftransformreset},
}
\makeatother

\begin{document}
\begin{tikzpicture}
% separately plot and box, else tikzedt don't show handles
\draw [black,thick] (1,3) rectangle (3.5,4)
  node[fitting node] (mynode) {};
%/* % also make tikzedt ignore (do not parse) this, plot kills all handles
\draw let \p1=(mynode) in
  [black, thick, domain=0:2.5,samples=50]
  plot (\x,{0.5*exp(-\x)*sin(1000*\x)});
%*/
\end{tikzpicture}
\end{document}

...我明白了:

测试.png

我正在使用tikzedt,通过这种语法,它为我提供了移动矩形节点的句柄;我想将情节部分放在里面,这样它就会随着节点一起移动。

不幸的是,如果遇到或由操作导致的崩溃(例如),则\draw plot 崩溃会产生完全错误的结果。\x1\y1letplot ({\x1+\x},{\y1+0.5*exp(-\x)*sin(1000*\x)});

\draw plot那么,我怎样才能在里面移动(mynode)(也就是说,让它的定位参考(mynode),而不是明确的)?

答案1

好吧,本来可以用的shift,希望我早点记住:

\draw let \p1=(mynode.west) in
  [black, thick, domain=0:2.5,samples=50,shift=(\p1)]
  plot ({\x},{0.5*exp(-\x)*sin(1000*\x)});

测试.png

相关内容