Skip to content

Attempt to create a dynamically changing plot in console and notebook #9606

@dsblank

Description

@dsblank

Bug report

Bug summary

Trying to have a dynamic plot that gets created and iteratively updated in a single function, both in the notebook, and in the console:

Python 3.6.1 |Anaconda custom (x86_64)| (default, May 11 2017, 13:04:09) 
Type 'copyright', 'credits' or 'license' for more information
IPython 6.1.0 -- An enhanced Interactive Python. Type '?' for help.

Other software versions:

  • notebook (5.1.0)
  • ipywidgets (7.0.0)
  • jupyter (1.0.0)
  • jupyter-client (5.1.0)
  • jupyter-console (5.1.0)
  • jupyter-core (4.3.0)

Code for reproduction

In the notebook, this is preceded with %matplotlib notebook. Testing on the Mac for the console part. All one cell.

import matplotlib.pyplot as plt
import numpy as np
import time

fig = plt.figure()
fig.show()

for j in range(10):            
    plt.plot(range(0, j), [1/(i+1) for i in range(0, j)])
    fig.canvas.draw()
    time.sleep(.05)      

Actual outcome

  1. in the notebook, the figure size changes (initial is small, final fills area)
  2. in the console, the plot doesn't show up until all done plotting

Matplotlib version

  • Operating system: MacOSX, Darwin 16.7
  • Matplotlib version: matplotlib (2.0.2)
  • Matplotlib backend: MacOSX
  • Python version: 3.6
  • Jupyter version (if applicable): 1.0.0
  • Other libraries: (see above), anaconda install

Metadata

Metadata

Assignees

No one assigned

    Labels

    GUI: nbaggstatus: closed as inactiveIssues closed by the "Stale" Github Action. Please comment on any you think should still be open.status: inactiveMarked by the “Stale” Github Action

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions