There is a dedicated plotting package built on tikz
namely, pgfplots
. One implementation of your plot in that could be:

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[domain=-.7:3.2, ymin=-1, ymax=1,
axis x line=middle, axis y line=middle, ticks=none,
enlarge x limits={rel=0.07}]
\addplot[thick, red, samples=100] {(x*x*(1-x)*(3-x))};
\addplot[green] {(.5)} node[right]{$E$};
\end{axis}
\end{tikzpicture}
\end{document}
You can move the codomain restrictions to just the one function, but putting them as options to the \addplot
command, but you have to use the option
restrict y to domain=-1:1
and to get the cut-off right in your example you then have to increase the number of samples:
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[domain=-.7:3.2,
axis x line=middle, axis y line=middle, ticks=none,
enlarge x limits={rel=0.07}]
\addplot[thick, red, samples=5000, restrict y to domain=-1:1] {(x*x*(1-x)*(3-x))};
\addplot[green] {(.5)} node[right]{$E$};
\end{axis}
\end{tikzpicture}
\end{document}
If you want to control the axis lengths precisely, use xmin
/xmax
/ymin
/ymax
and adjust the domains on the individual plots:

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\begin{document}
\begin{tikzpicture}
\begin{axis}[xmin=-5, xmax=5, ymin=-1.2, ymax=1.2,
axis x line=middle, axis y line=middle, ticks=none]
\addplot[thick, red, samples=5000,
domain=-.7:3.2, restrict y to domain=-1:1] {(x*x*(1-x)*(3-x))};
\addplot[domain=-5:4.2, green] {(.5)} node[right]{$E$};
\end{axis}
\end{tikzpicture}
\end{document}