函数在某点的不连续性

函数在某点的不连续性

在示例中,我使用该arrows.meta库在某点 (2.4) 处绘制了一个不连续函数,但结果并不确定,因为可以看出端点位置不对。否则该怎么办?

在此处输入图片描述

在此处输入图片描述

  \documentclass[6pt]{standalone}
  \usepackage{pgfplots}
  \usepgfplotslibrary{fillbetween}
  \usetikzlibrary{arrows,
            arrows.meta,
            bending}
  \pgfplotsset{compat=1.12}

  \begin{document}

  \begin{tikzpicture}

  \begin{axis}[
    restrict x to domain=-3:5, xmax=5, xmin=-3,
    restrict y to domain=-3:6, ymax=6, ymin=-3,
    x=0.5cm,
    y=0.5cm,
    axis lines=middle,
    axis line style =thick,
    major tick style=black,
    major grid style=gray,
    minor grid style=gray,
    grid=both,
    xtick={-2,...,4},
    ytick={-2,...,5},
    yticklabels={,,},
    xticklabels={,,},
    extra x ticks={-3,5},
    extra x tick label={\null},
    extra y ticks={-3,6}, 
    extra y tick label={\null},
    extra tick style={tick style={draw=none}},
    xlabel=$x$,ylabel=$y$,
    every axis x label/.style={
    at={(ticklabel* cs:1.01)},
   anchor=west,
   },
   every axis y label/.style={
   at={(ticklabel* cs:1.01)},
   anchor=south,
   },
   samples=1000,
   >=stealth,
  ]

  \draw[{Circle[length=3pt]}-{Circle[length=3pt]},line width=0.8pt](2,5)--(4,3);
  \draw[{Circle[length=3pt]}-{Arc Barb [reversed,length=0.1cm]},line width=0.8pt](-2,3)--(-1,1)--(2,4);



 \node[below] at (1,0){$1$};
 \node[left] at (0,1) {$1$};
 \node[below left] at (0,0) {$0$};

 \end{axis}
 \end{tikzpicture}
 \end{document}

答案1

将节点放在坐标处,而不是将点作为箭头的一部分。在图片之前的某个地方定义点的外观为

\tikzset{dot/.style={circle,draw,fill=black,minimum size=1mm,inner sep=0mm}}

并将\draw命令替换为

\draw[{}-{Arc Barb [reversed,length=0.1cm]},line width=0.8pt]
  (-2,3) node[dot]{} -- (-1,1) -- (2.13,4.13);
\draw[line width=0.8pt]
  (2,5) node[dot]{} -- (4,3) node[dot]{};

这导致

在此处输入图片描述

相关内容