当尝试回答时如何在 Tikz 中删除曲线的一部分?intersection segments
,我在 PGFPlots 中遇到了问题fillbetween
。我尝试将曲线从 更改to[out=280,in=175]
为 控制点,以及其他一些操作。我总是得到相同的结果:
- 红色 L1 看起来正确。
- 绿色 L2 沿着曲线行驶,但终点错误。
- 蓝色 L3 有正确的端点,但不遵循曲线。
我究竟做错了什么?
\documentclass[tikz, border=1cm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{fillbetween}
\begin{document}
\begin{tikzpicture}
\draw[name path=curve] (0.3,5) to[out=280,in=175, looseness=0.92] (5.5,0.5); %a curve
%\draw[name path=curve] (0.3,5) .. controls (1,1) and (2,0) .. (5.5,0.5); %alternative curve
\draw[name path=line] (0,4.1) -- (4.1,0);
\draw[red, ultra thick, opacity=0.5, smooth, intersection segments={of=curve and line, sequence={L1}}];
\pgfgetlastxy{\XCoord}{\YCoord}
\draw (\XCoord,\YCoord) circle (1pt);
\draw[green, ultra thick, opacity=0.5, smooth, intersection segments={of=curve and line, sequence={L2}}];
\pgfgetlastxy{\XCoord}{\YCoord}
\draw (\XCoord,\YCoord) circle (1pt);
\draw[blue, ultra thick, opacity=0.5, smooth, intersection segments={of=curve and line, sequence={L3}}];
\pgfgetlastxy{\XCoord}{\YCoord}
\draw (\XCoord,\YCoord) circle (1pt);
\end{tikzpicture}
\end{document}