Answer
$f(x)=\left\{
\begin{array}{cc}
-x-1 & \quad x \leq 0 \\
x+2 & \quad x \gt 0
\end{array}
\right.$
Work Step by Step
Each piece of the function is linear.
When $x\leq0$, the graph is the line given by
$y=mx+b$ where slope
$m=\frac{y_{2}-y_{1}}{x_{2}-x_{1}}=\frac{3-1}{-4-(-2)}=-1$ and
y-intercept $b=-1$.
$\implies y=-1(x)+(-1)=-x-1$
When $x\gt0$, the graph is the line given by
$y=mx+b$ where slope
$m=\frac{4-3}{2-1}=1$ and
y-intercept $b=2$.
$\implies y=x+2$
So, a piecewise function for the graph is
$f(x)=\left\{
\begin{array}{cc}
-x-1 & \quad x \leq 0 \\
x+2 & \quad x \gt 0
\end{array}
\right.$