3

plots to reproduce

Hi everyone! I should reproduce these plots (above) and I'm so far that I have everything except for the plots themselves. Does anyone here have an idea what kind of plots should I take? I'm not a math-pro and google couldn't help me either.

Here the code and what I've got so far (this is my first question and I don't know why the formatting of the code doesn't work, sorry for that):

    \documentclass{standalone}

\usepackage{pgfplots}

\begin{document}
  \begin{tikzpicture}
      \begin{axis}[
        restrict y to domain=-5:5,
        samples=1000,
        ticks=none,
        xmin = -1, xmax = 5,
        ymin = -1, ymax = 5,
        unbounded coords=jump,
        axis x line=middle,
        axis y line=middle,
        x label style={
          at={(axis cs:5.02,0)},
          anchor=west,
        },
        every axis y label/.style={
          at={(axis cs:0,5.02)},
          anchor=south
        },
        legend style={
          at={(axis cs:-5.2,5)},
          anchor=west, font=\scriptsize
        }
        ]

    \draw[dashed] (axis cs:2,0) -- (axis cs:2,2);
    \draw[dashed] (axis cs:0,2) -- (axis cs:2,2);
    \node[below right, font=\scriptsize] at (axis cs:2,0) {$a$};
    \node[below right, font=\scriptsize] at (axis cs:2,4) {$stetig$};
    \node[above left, font=\scriptsize] at (axis cs:0,2) {$f(a)$};
    \end{axis}
  \end{tikzpicture}

  \begin{tikzpicture}
      \begin{axis}[
        restrict y to domain=-5:5,
        samples=1000,
        ticks=none,
        xmin = -1, xmax = 5,
        ymin = -1, ymax = 5,
        unbounded coords=jump,
        axis x line=middle,
        axis y line=middle,
        x label style={
          at={(axis cs:5.02,0)},
          anchor=west,
        },
        every axis y label/.style={
          at={(axis cs:0,5.02)},
          anchor=south
        },
        legend style={
          at={(axis cs:-5.2,5)},
          anchor=west, font=\scriptsize
        }
        ]

    \draw[dashed] (axis cs:2,0) -- (axis cs:2,2);
    \draw[dashed] (axis cs:0,1) -- (axis cs:2,1);
    \draw[dashed] (axis cs:0,2) -- (axis cs:2,2);
    \node[below right, font=\scriptsize] at (axis cs:2,0) {$a$};
    \node[below right, font=\scriptsize] at (axis cs:2,4) {$nicht \; stetig$};
    \node[above left, font=\scriptsize] at (axis cs:0,2) {$f(a)$};
    \end{axis}
  \end{tikzpicture}
\end{document}

enter image description here

  • This seems more math than LaTeX/PgfPlots question ... – Zarko Feb 13 '16 at 13:46
3

Since the drawing is about continuity and discontinuity, there's no need to exactly plot specifically these functions. You could use any continuous and discontinuous functions. You could even make a coordinates plot with smooth path between.

But let's find a function based on your coordinates. The drawing looks like made of pieces of a circle, so let's use a function which can give us a circle, and limit its domain.

First plot:

\addplot [no markers, domain=1.3:4] { sqrt(8-(x-4)^2)};

For the second plot, we plot the function two times, but shift it the second time, again with limited domains.

\addplot [no markers, domain=1.3:2] { -sqrt(8-(x)^2)+3};
\addplot [no markers, domain=2:2.8] { -sqrt(8-(x)^2)+4};

We get:

Function plots

  • Thank you very much! This is exactly what I wanted. Special thanks to the good explanation! – Latex beginner Feb 13 '16 at 19:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.