Skip to content

[Doc]: subplot behavior is not same as the doc reads in 3.10(stable) #29447

@mocheng

Description

@mocheng

Documentation Link

https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.subplot.html

Problem

In the given doc link for version 3.10(stable), it reads

Creating a new Axes will delete any preexisting Axes that overlaps with it beyond sharing a boundary:

The code is as below

import matplotlib.pyplot as plt
# plot a line, implicitly creating a subplot(111)
plt.plot([1, 2, 3])
# now create a subplot which represents the top plot of a grid
# with 2 rows and 1 column. Since this subplot will overlap the
# first, the plot (and its Axes) previously created, will be removed
plt.subplot(211)

I tried to run the code in colab. It turns out that subplot doesn't remove previous plotting any more.

image

Suggested improvement

I recall the subplot behavior does remove previous plotting. Perhaps some code change alter the behavior. The current behavior is good.

I suppose the doc should be updated to match the actual behavior.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions