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.

Usage:

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
figure()
for i in arange(x):
    x.flat[i] = 1
    drawnow(function_to_draw_figure)

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)

Installation

Two options:

  1. Download this repository and run python setup.py 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.

Source Distribution

drawnow-0.44.tar.gz (2.3 kB view details)

Uploaded Source

File details

Details for the file drawnow-0.44.tar.gz.

File metadata

  • Download URL: drawnow-0.44.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for drawnow-0.44.tar.gz
Algorithm Hash digest
SHA256 590067276750b8c3d45388191af7569f46c49a8282537d2f8cecc8a08fac5df9
MD5 8573de81bfb04a76fa8521f89f407c43
BLAKE2b-256 2711a55a02da42134d0f1e57f5575489f7d3c4400d19f760e3725a62fef94452

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page