TikZ: 간격이 있는 기능을 위한 천공 지점

TikZ: 간격이 있는 기능을 위한 천공 지점

아래 그림과 같이 간격이 있는 함수 그래프를 만들고 위쪽 지점에 구멍이 나도록 해야 합니다. 수동으로 작은 원을 만들고 위의 선을 맞게 조정하는 것 외에 다른 방법이 있습니까?

여기 내 MWE가 있습니다.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}

\begin{document}
    \begin{tikzpicture}[declare function={sigma(\x)=1/(1+exp(-\x));}]
    \begin{axis}
    [
        grid=major,     
        xmin=-6,
        xmax=6,
        axis x line=bottom,
        ytick={0,.5,1},
        ymax=1,
        axis y line=middle,
        samples=100,
        domain=-6:6,
        legend style={at={(1,0.9)}}     
    ]
        \draw [dashed,black!50] (1,0.365) -- (1,0.865);
        \addplot[very thick,black,mark=none, samples=100,domain=-6:1]   (x, {.5 * sigma(x)});
        \addplot[very thick,black,mark=none, samples=100,domain=1:6]   (x, {.5 + .5 * sigma(x)});
    \end{axis}
    \end{tikzpicture}

\end{document}

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

답변1

선을 맞춰 조정한다는 것이 무슨 뜻인지 잘 이해가 안 되지만, 함수를 선언하고 이를 사용하여 플롯, 점선, 원 등 모든 것을 그립니다.

pgfplots를 설정하여 첫 번째 지점에만 마커를 그리는 것이 가능합니다 mark repeat=N. 여기서 N는 샘플 수보다 크거나 같은 숫자입니다. 따라서 당신은 할 수 있습니다

\addplot[very thick,black,mark=*,mark options={fill=white},domain=1:6, mark repeat=1000]  {F(x)+0.5};

마커를 포함하여 후반부를 그립니다. F로 선언된 함수입니다 declare function. 아래 코드를 참조하세요.

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

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}

\begin{document}
    \begin{tikzpicture}[
        declare function={
           sigma(\x)=1/(1+exp(-\x));
           F(\x) = 0.5 * sigma(\x);
           }]
    \begin{axis}
    [
        grid=major,     
        xmin=-6,
        xmax=6,
        axis x line=bottom,
        ytick={0,.5,1},
        ymax=1,
        axis y line=middle,
        samples=100,
        legend style={at={(1,0.9)}}     
    ]
        \addplot[very thick,black,mark=none, domain=-6:1]   {F(x)};
        \addplot[very thick,black,mark=*,mark options={fill=white},domain=1:6, mark repeat=1000]    {F(x)+0.5};

        \draw [dashed,black!50] (1,{F(1)}) -- (1,{F(1)+0.5});        
    \end{axis}
    \end{tikzpicture}

\end{document}

관련 정보