Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Incorrect example for interactive plotting in Matplotlib Usage FAQ #8883

Closed
@vab9

Description

@vab9

Bug report

Bug summary

The interactive example in the Matplotlib FAQ does not work as described.

Code for reproduction

I followed these very simple instructions from the FAQ:

# in shell execute one by one:
import matplotlib.pyplot as plt

plt.ion()
plt.plot([1.6, 2.7])

# plot is shown

plt.title("interactive test")
plt.xlabel("index")

# plot is updated with titel and label

ax = plt.gca()
ax.plot([3.1, 2.2])

# (!) second line is added to the axes
# no need to call:
# plt.draw()

When I execute:

# Paste your code here
ax = plt.gca()
ax.plot([3.1, 2.2])

my plot immediately updates with the new line. The FAQ claims this should not happen until I call draw().

The same thing happens when I use the 'TKAgg' backend and not my default 'MacOSX'. I also tried this with both Python and iPython.

Actual outcome

Plot is updated with new line.

Expected outcome

Plot should not be updated until draw() is called.

Matplotlib version

  • Operating System: Mac OSX 10.11.6
  • Matplotlib Version: 2.0.2
  • Python Version: 3.6.1
  • Anaconda Version: 4.4.0
  • Jupyter Version (if applicable): 4.3.0

Installed matplotlib by installing Anaconda 4.4.0 (default channel).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions