.. _interactive: Interactive Mode ================ | Normally the figure is rendered only when you call :meth:`show() `. | The :meth:`interactive() ` method flips that: while it is on, every figure-mutating call reprints the whole figure *immediately*, so each change appears without an explicit :meth:`show() ` call. .. code-block:: python import plotext as plt fig = plt.figure fig.clear() fig.interactive() # turn interactive mode on fig.draw(fig.signal(plt.sin())) # each of these reprints the figure fig.title("Interactive") fig.theme("dark") fig.interactive(False) # back to manual show() .. note:: This is the same convenience as `matplotlib `_'s ``plt.ion()``: handy at the interactive Python prompt, when building a plot up step by step. What triggers a reprint: - Every method changing the figure reprints it once complete: :meth:`draw() `, :meth:`line() `, :meth:`event() `, and every setting method, like :meth:`title() `, :meth:`theme() `, :meth:`ruler().lim() ` or the :doc:`clear ` family. - A single call reprints exactly **once**, even when it acts on several settings internally, like :meth:`clear() `, or reaches several :ref:`subplots ` at once. - The signal creating methods, like :meth:`signal() ` or :meth:`bar() `, only return their signal, leaving the figure *untouched*: the reprint comes when the signal is passed to :meth:`draw() `, the moment the content actually lands on the figure. .. important:: Interactive mode is a session toggle, not a plot setting: it persists across :meth:`clear() ` and is switched off only by :meth:`interactive(False) `. Enabling it is silent, the next figure-changing call produces the first reprint.