부드러운 곡선 세그먼트

부드러운 곡선 세그먼트

이전 세그먼트에 부드럽게 연결된 곡선의 마지막 세그먼트(점선)가 필요합니다. 다른 개선사항도 제안해주세요!

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}
\begin {axis}[
    height=5cm, width=12cm,
    xmin=-6, xmax=21, ymin=0, ymax=6, 
   xlabel={}, 
    ylabel={trade effect}, 
    ylabel style={align=center}, 
    axis x line=bottom, axis y line = left, 
    axis line style={-latex, thick},
    xticklabels={,,}, yticklabels={,,},
    ytick=\empty,
    xtick={-5,0,5,10,15},
    xticklabels={$t_{a}$,$t_{b}$,$t_{c}$,$t_{d}$,$t_{e}$},
    ]
\addplot [mark=none, line width=.8pt, smooth]coordinates {
    (-5,0) (0,1)(5,4) (10,5) (15,5)};
\addplot[mark=none, line width=.8pt, smooth, dashed] coordinates {
    (15,5) (20,4)};
\addplot[mark=none, dashed] coordinates {(0,0) (0,6)};
\addplot[mark=none, dashed] coordinates {(5,0) (5,6)};
\addplot[mark=none, dashed] coordinates {(10,0) (10,6)};
\addplot[mark=none, dashed] coordinates {(15,0) (15,6)};
\end{axis}
\end{tikzpicture}
\end{document}

여기에 이미지 설명을 입력하세요

답변1

플롯을 실선으로 한 번, 점선으로 한 번, 두 번 그린 다음 각각의 대상 도메인을 클립합니다.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}
\begin {axis}[
    height=5cm, width=12cm,
    xmin=-6, xmax=21, ymin=0, ymax=6, 
   xlabel={}, 
    ylabel={trade effect}, 
    ylabel style={align=center}, 
    axis x line=bottom, axis y line = left, 
    axis line style={-latex, thick},
    xticklabels={,,}, yticklabels={,,},
    ytick=\empty,
    xtick={-5,0,5,10,15},
    xticklabels={$t_{a}$,$t_{b}$,$t_{c}$,$t_{d}$,$t_{e}$},
    ]
\begin{scope}   
\clip (\pgfkeysvalueof{/pgfplots/xmin},\pgfkeysvalueof{/pgfplots/ymin})
 rectangle (15,\pgfkeysvalueof{/pgfplots/ymax});
\addplot [mark=none, line width=.8pt, smooth] coordinates {
    (-5,0) (0,1)(5,4) (10,5) (15,5) (20,4)};
\end{scope} 
\begin{scope}   
\clip (15,\pgfkeysvalueof{/pgfplots/ymin})
 rectangle (\pgfkeysvalueof{/pgfplots/xmax},\pgfkeysvalueof{/pgfplots/ymax});
\addplot [mark=none, line width=.8pt, smooth,dashed] coordinates {
    (-5,0) (0,1)(5,4) (10,5) (15,5) (20,4)};
\end{scope} 
\addplot[mark=none, dashed] coordinates {(0,0) (0,6)};
\addplot[mark=none, dashed] coordinates {(5,0) (5,6)};
\addplot[mark=none, dashed] coordinates {(10,0) (10,6)};
\addplot[mark=none, dashed] coordinates {(15,0) (15,6)};
\end{axis}
\end{tikzpicture}
\end{document}

여기에 이미지 설명을 입력하세요

관련 정보