# How to draw this graph in LaTeX [duplicate]

I would like help drawing a specific graph in LaTeX

## marked as duplicate by Henri Menke tikz-pgf StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Mar 1 at 7:10

• Please indicate what you have tried, and where you got stuck. The pgfplots package is suitable for this sort of problem. – Benjamin McKay Feb 28 at 19:49
• welcome to tex.se! what you try so far? how you like to help? which package for drawing you like to use? – Zarko Feb 28 at 19:49

IMHO this is not a free hand graph.

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}
\begin{axis}[xlabel=$x$, ylabel=$y$,ymax=4,ymin=-4,unbounded coords=jump,
axis lines=middle,title style={at={(1,1)},anchor=north east},
title={$y=f(x)$},xtick={-2,0,2,4},ytick={-1},
]
\draw[fill=white] (3,-1) circle (1.5pt);
\draw[fill] (5,-1) circle (1.5pt);
\draw (3,4) -- (3,-4);
\end{axis}
\end{tikzpicture}
\end{document}

Or something with more pi's to prepare for the upcoming pi day. (This is just to say that there are infinitely many similarly looking functions.)

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16,width=12cm,height=7cm}
\begin{document}
\begin{tikzpicture}
\begin{axis}[xlabel=$x$, ylabel=$y$,ymax=4,ymin=-4,unbounded coords=jump,
axis lines=middle,title style={at={(1,1)},anchor=north east},
title={$y=f(x)$},xtick={-2,0,2,4},ytick={-1},
]
\draw[fill=white] (3,-1) circle (1.5pt);
\draw[fill] (5,-1) circle (1.5pt);
\draw (3,4) -- (3,-4);
\end{axis}
\end{tikzpicture}
\end{document}