Skip to content

Subplots using bad axis limits in 3.2 #17203

Closed
@kannes

Description

@kannes

Bug report

Bug summary

Subplots are sometimes using bad axis limits depending on the number and layout of subplots.

I guess those axis limits are guess from what gets plotted.

This happens in 3.2.1 but not in 3.1.2. I looked through the changelogs of 3.2 releases and saw nothing about axis limits. Sorry if I missed it.

Code for reproduction

Here I plot a point at x=0, y=0:

import matplotlib.pyplot as plt

for rows in range(1, 3):
    for cols in range(1, 3):
        
        # skip single plot, no subplot there
        if rows == 1 and cols == 1: continue

        fig, axes = plt.subplots(rows, cols)

        for i, ax in enumerate(axes.ravel()):
            ax.scatter(x=0, y=0)
        
        plt.show()

Actual outcome, in 3.2.1
1_2
2_1
2_2

Expected Outcome, in 3.1.2
1_2
2_1
2_2

Matplotlib version

  • Operating system: Archlinux

  • Matplotlib version: 3.2.1 from Arch repos

  • Matplotlib backend (print(matplotlib.get_backend())): Qt5Agg, module://ipykernel.pylab.backend_inline

  • Python version: 3.8.2 from Arch repos

  • Matplotlib 3.1.2 from pip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions