
有了這個 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}
……我明白了:
我正在使用tikzedt
, 並通過這種語法,它為我提供了移動矩形節點的句柄;我希望將繪圖部分放在其中,以便它與節點一起移動。
不幸的是,如果遇到崩潰或由於操作而導致崩潰(例如,如 中所示),則\draw
plot
崩潰會給出完全錯誤的結果。\x1
\y1
let
plot ({\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)});