![如何绘制以下函数图像?](https://linux22.com/image/415308/%E5%A6%82%E4%BD%95%E7%BB%98%E5%88%B6%E4%BB%A5%E4%B8%8B%E5%87%BD%E6%95%B0%E5%9B%BE%E5%83%8F%EF%BC%9F.png)
答案1
这是一种生成此类图的临时方法:只需在不连续处添加节点即可。
\documentclass[tikz,border=3mm]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\pgfplotsset{compat=1.17}
\begin{document}
\begin{tikzpicture}[circ/.style={circle,draw,inner sep=1pt},
declare function={%
f1(\x)=1-1*pow(\x-0.6,2);
f2(\x)=1.5-0.25*\x*\x+0.03*pow(\x,4);
f3(\x)=0.6-0.05*x*x+0.2*pow(\x-1,3)+0.06*pow(\x-1,4);
}]
\pgfplotsset{axis lines=middle,xtick=\empty,ytick=\empty,
xlabel={$x$},ylabel={$y$},xmin=-2.5,xmax=4,ymin=-1,ymax=3,
}
\begin{groupplot}[every axis plot/.append style={smooth},
group style={group size=2 by 1,
horizontal sep=1cm},height=5cm,width=6cm]
\nextgroupplot
\draw[dashed] (1,{f2(1)}) -- (1,0);
\addplot[domain=-1:1] {f1(x)} coordinate[pos=1,circ,fill=white];
\addplot[domain=1:3] {f2(x)} coordinate[pos=0,circ,fill=black];
\nextgroupplot
\addplot[domain=-2:2.5] {2.5*f3(x)};
\end{groupplot}
\end{tikzpicture}
\end{document}