\documentclass{article}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}
[
xmin=-1.2,xmax=2.2,ymin=-0.2,ymax=1.5,
width=5cm,height=3cm,xlabel={x},ylabel={y},
xtick={-1,1,2},ytick={1},
axis x line=middle,axis y line=middle,
x label style={
at={(axis description cs: 1.12,0.00 ) },
},
y label style={
at={(axis description cs: 0.29,1.3 ) },
},
grid=major,
x tick label style={color=white},
y tick label style={color=white},
]
\addplot
[
domain=-1:0,line width=0.5mm,color=blue!70!red,
]
{1};
\addplot
[
domain=0:1,line width=0.5mm,color=blue!70!red,
]
{0};
\addplot
[
domain=1:2,line width=0.5mm,color=blue!70!red,
]
{1};
\addplot
[
domain=1:2,line width=0.5mm,color=blue!70!red,
mark=*,
]
table
{
-1 1
};
\addplot
[
domain=1:2,line width=0.5mm,color=blue!70!red,
mark=*,
]
table
{
0 0
};\addplot
[
domain=1:2,line width=0.5mm,color=blue!70!red,
mark=*,
]
table
{
1 1
};
\end{axis}
\end{tikzpicture}

\end{document}