指向错误方向的标注

指向错误方向的标注

我想知道为什么我的标注指针指向错误的方向。它应该指向坐标 (-2,1)。我在这里做错了什么?

\documentclass[tikz]{standalone}

\usepackage{kpfonts}
\usepackage{tkz-fct}
\usetkzobj{all}
\usetikzlibrary{shapes.callouts} 


\begin{document}

\begin{tikzpicture}[>=stealth', remember picture, note/.style={rectangle callout, fill=#1}]
\tkzInit[xmin=-2.5,xmax=1.75,ymin=-0.5,ymax=2.7,xstep=1,ystep=1]
\tkzAxeXY
\tkzFct [<-,style={draw},domain=-2.3:-1,thick,outer sep=0pt] {(x+1)**2}
\tkzFct [domain=-1:0,thick] {2*x+2}
\tkzFct [domain=0:1,thick,outer sep=0pt] {2-x}
\tkzFct [->,domain=1:1.6,thick,outer sep=0pt] {x**2}
\tkzDefPoint(-1,0){A}
\tkzDefPoint(0,2){B}
\tkzDefPoint(1,1){C}
\tkzDrawPoints[size=3](A,B,C)
\tkzDefPoint(-2,1){D}
\tkzDefPoint(1.5,2.25){E}
\tkzDefPoint(-1.5,2){F}
\tkzDefPoint(0.75,2.3){G}
\tkzDrawSegments[very thin](D,F E,G)
%\tkzDrawPoint[size=3](C)
\node [above] at (G) {\scriptsize $y=x^2$};
\node [above, callout relative pointer={(-2,1)},rounded corners,note=green!50, opacity=.5, overlay] at (F) {\scriptsize $y=(x+1)^2$};
\end{tikzpicture}

\end{document}

在此处输入图片描述

答案1

实现中有一个错误,Daniel 在他的回答中修复了该错误标注和投影仪

与此同时,你可以通过以下方式伪造

\documentclass[tikz]{standalone}

\usepackage{kpfonts}
\usepackage{tkz-fct}
\usetkzobj{all}
\usetikzlibrary{shapes.callouts,calc} 


\begin{document}

\begin{tikzpicture}[>=stealth', remember picture, note/.style={rectangle callout, fill=#1}]
\tkzInit[xmin=-2.5,xmax=1.75,ymin=-0.5,ymax=2.7,xstep=1,ystep=1]
\tkzAxeXY
\tkzFct [<-,style={draw},domain=-2.3:-1,thick,outer sep=0pt] {(x+1)**2}
\tkzFct [domain=-1:0,thick] {2*x+2}
\tkzFct [domain=0:1,thick,outer sep=0pt] {2-x}
\tkzFct [->,domain=1:1.6,thick,outer sep=0pt] {x**2}
\tkzDefPoint(-1,0){A}
\tkzDefPoint(0,2){B}
\tkzDefPoint(1,1){C}
\tkzDrawPoints[size=3](A,B,C)
\tkzDefPoint(-2,1){D}
\tkzDefPoint(1.5,2.25){E}
\tkzDefPoint(-1.5,2){F}
\tkzDefPoint(0.75,2.3){G}
\tkzDrawSegments[very thin](D,F E,G)
%\tkzDrawPoint[size=3](C)
\node [above] at (G) {\scriptsize $y=x^2$};
\node [above,rectangle callout, callout relative pointer={($(-2,1)-(F)$)},
rounded corners,note=green!50, opacity=.5, overlay] at (F) {\scriptsize $y=(x+1)^2$};
\end{tikzpicture}

\end{document}

相关内容