Answer
See the graph below:
Work Step by Step
In order to draw the graph of the function $f\left( x \right)=\left\{ \begin{align}
& 2\text{ if }x\le 0 \\
& -1\text{ if }x>0 \\
\end{align} \right.$
replace $f\left( x \right)$ with y.
Therefore,
$y=\left\{ \begin{align}
& 2\text{ if }x\le 0 \\
& -1\text{ if }x>0 \\
\end{align} \right.$
Now, for $x\le 0$ , the value of y is 2, and for $x>0$ , the value of y is -1.