答案1
这是使用的建议intersection segments
。它需要 pgfplots 库fillbetween
。
\documentclass[border=2pt]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{fillbetween}
\begin{document}
\begin{tikzpicture}
\begin{axis}[xmax=9,ymax=9, samples=50,set layers]
\addplot[name path=plot 1,blue, ultra thick] (x,x*x);
\addplot[name path=plot 2, red, ultra thick] (x*x,x);
\begin{pgfonlayer}{axis tick labels}
\fill[green,
intersection segments={
of=plot 1 and plot 2,
sequence={L2--R2[reverse]}
}];
\end{pgfonlayer}
\end{axis}
\end{tikzpicture}
\end{document}
结果: