← All examples

Interactive Plot with a Variable

Two psplots coupled to a draggable uservariable with custom scaling.

This diagram is interactive — use your mouse or touch to play with it.

Rendering LaTeX…

Source

\psset{unit=0.75cm}
\begin{pspicture}(-4,-3)(4,6)
\uservariable{alpha}(0.1,0){x}
\psplot[algebraic,linewidth=2pt]{-4}{4}{pow(x,2)}
\psplot[algebraic,linecolor=blue,linewidth=3]{-4}{4}{4*(x-alpha)*alpha}
\psline{->}(-4,0)(4,0)
\end{pspicture}
Open in sandbox