Skip to main content

MATLAB-like drawnow

Project description

drawnow for matplotlib

Matlab has a great feature where it allows you to update a figure. You can simply call drawnow and have your figure update. This is nice if you’re running a simulation and want to see the results every iteration. It’d sure be nice if Python/matplotlib had a similar feature to update the plot each iteration. This package adds that functionality to matplotlib.


from drawnow import drawnow

x = zeros((N,N))

def function_to_draw_figure():
    #figure() # don't call, otherwise new window opened
    imshow(x) # python's global scope
    #show()   # don't call show()!

ion() # enable interactivity, can be default
for i in arange(x):
    x.flat[i] = 1

If you want to wait for confirmation after update, call drawnow(function_to_draw_figure, confirm=True).

If you only want to show the figure once, call drawnow(function_to_draw_figure, show_once=True)


Two options:

  1. Download this repository and run python install.
  2. Run pip install drawnow.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for drawnow, version 0.44
Filename, size File type Python version Upload date Hashes
Filename, size drawnow-0.44.tar.gz (2.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page