Skip to content

[Bug]: Mismatch in documented default behaviour of pcolormesh 'snap' #30709

@mo-nstebbin

Description

@mo-nstebbin

Bug summary

The documentation for pcolormesh states the default behaviour for snap is False. Since a supposed temporary addition of pcolormesh.snap to the default rcParams under b38c7de for 3.4.3, this is no longer the case and instead you get True behaviour by default. The documentation and default behaviour should probably match.

This switch in default behaviour is most obvious when plotting a pcolormesh plot with an alpha value less than 1.

Code for reproduction

import matplotlib as mpl
import matplotlib.pyplot as plt

test_array = [
             [1, 3, 5, 6, 2, 1],
             [0, 2, 4, 6, 3, 1],
             [1, 2, 4, 4, 2, 1],
             [0, 0, 2, 3, 2, 1],
             [0, 0, 1, 2, 2, 0],
             [0, 0, 1, 1, 0, 0],
             ]

p1 = plt.pcolormesh(test_array, alpha=0.5)

#print(mpl.rcParams['pcolormesh.snap'])
print("default", p1.get_snap())

plt.savefig(f"test_snapD_old.png")
plt.close()

Actual outcome

Under 3.10.1

True
default True
Image

Expected outcome

Under 3.3.4

default None
Image

Additional information

Either the temporary rcParam should be removed from the default template or the documentation should be changed to match the present default behaviour.

Operating system

No response

Matplotlib Version

3.10.1

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Installation

None

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions