Skip to main content

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.

Release files for drawnow 0.44

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for drawnow 0.44
File Size Uploaded
drawnow-0.44.tar.gz 2.3 kB Details

Release files / drawnow-0.44.tar.gz

Download URL drawnow-0.44.tar.gz
Size 2.3 kB
Tags Source
SHA-256 checksum
How to use checksums
590067276750b8c3d45388191af7569f46c49a8282537d2f8cecc8a08fac5df9
BLAKE2b-256 checksum
How to use checksums
2711a55a02da42134d0f1e57f5575489f7d3c4400d19f760e3725a62fef94452
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.72.5

2 release files

0.72.4

2 release files

0.72.1

1 release file

0.71.4

1 release file

0.71.3

1 release file

0.71.2

1 release file

0.71.1

1 release file

0.71

1 release file

0.70

1 release file

0.60

1 release file

0.54

1 release file

This release

0.44 This release

1 release file

0.43

1 release file

0.42

1 release file

0.41

1 release file

0.4

1 release file

0.3

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page