Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Remove the forced disabling of antialiasing in contourf/pcolormesh/pc…
…olor/tripcolor
  • Loading branch information
ayshih committed Oct 9, 2026
commit b806969181a78872f019ec2cdcb8e3b5eca10a47
24 changes: 3 additions & 21 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6690,15 +6690,6 @@ def pcolor(self, *args, shading=None, alpha=None, norm=None, cmap=None,

Other Parameters
----------------
antialiaseds : bool, default: False
The default *antialiaseds* is False if the default
*edgecolors*\ ="none" is used. This eliminates artificial lines
at patch boundaries, and works regardless of the value of alpha.
If *edgecolors* is not "none", then the default *antialiaseds*
is taken from :rc:`patch.antialiased`.
Stroking the edges may be preferred if *alpha* is 1, but will
cause artifacts otherwise.

data : indexable object, optional
DATA_PARAMETER_PLACEHOLDER

Expand Down Expand Up @@ -6758,15 +6749,6 @@ def pcolor(self, *args, shading=None, alpha=None, norm=None, cmap=None,
kwargs['edgecolors'] = kwargs.pop('edgecolor')
ec = kwargs.setdefault('edgecolors', 'none')

# aa setting will default via collections to patch.antialiased
# unless the boundary is not stroked, in which case the
# default will be False; with unstroked boundaries, aa
# makes artifacts that are often disturbing.
if 'antialiaseds' in kwargs:
kwargs['antialiased'] = kwargs.pop('antialiaseds')
if 'antialiased' not in kwargs and cbook._str_lower_equal(ec, "none"):
kwargs['antialiased'] = False

kwargs.setdefault('snap', False)

if np.ma.isMaskedArray(X) or np.ma.isMaskedArray(Y):
Expand All @@ -6793,7 +6775,7 @@ def pcolor(self, *args, shading=None, alpha=None, norm=None, cmap=None,
@_preprocess_data()
@_docstring.interpd
def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
vmax=None, colorizer=None, shading=None, antialiased=False,
vmax=None, colorizer=None, shading=None,
**kwargs):
"""
Create a pseudocolor plot with a non-regular rectangular grid.
Expand Down Expand Up @@ -7004,7 +6986,7 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
kwargs.setdefault('snap', mpl.rcParams['pcolormesh.snap'])

collection = mcoll.QuadMesh(
coords, antialiased=antialiased, shading=shading,
coords, shading=shading,
array=C, colorizer=colorizer, alpha=alpha, **kwargs)
collection._scale_norm(norm, vmin, vmax)

Expand Down Expand Up @@ -7203,7 +7185,7 @@ def pcolorfast(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
collection = mcoll.QuadMesh(
coords, array=C,
alpha=alpha, cmap=cmap, norm=norm, colorizer=colorizer,
antialiased=False, edgecolors="none")
edgecolors="none")
self.add_collection(collection, autolim=False)
xl, xr, yb, yt = x.min(), x.max(), y.min(), y.max()
ret = collection
Expand Down
1 change: 0 additions & 1 deletion lib/matplotlib/axes/_axes.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,6 @@ class Axes(_AxesBase):
vmax: float | tuple[float, ...] | None = ...,
colorizer: Colorizer | None = ...,
shading: Literal["flat", "nearest", "gouraud", "auto"] | None = ...,
antialiased: bool = ...,
data: DataParamType = ...,
**kwargs
) -> QuadMesh: ...
Expand Down
15 changes: 4 additions & 11 deletions lib/matplotlib/contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,11 +673,6 @@ def __init__(self, ax, *args,
Keyword arguments are as described in the docstring of
`~.Axes.contour`.
"""
if antialiased is None and filled:
# Eliminate artifacts; we are not stroking the boundaries.
antialiased = False
# The default for line contours will be taken from the
# LineCollection default, which uses :rc:`lines.antialiased`.
super().__init__(
antialiaseds=antialiased,
alpha=alpha,
Expand Down Expand Up @@ -1646,18 +1641,16 @@ def _initialize_x_y(self, z):
:class:`matplotlib.units.ConversionInterface`.

antialiased : bool, optional
Enable antialiasing, overriding the defaults. For
filled contours, the default is *False*. For line contours,
it is taken from :rc:`lines.antialiased`.
Enable or disable antialiasing, overriding the defaults.
For filled contours, the default value is :rc:`patch.antialiased`.
For line contours, the default value is :rc:`lines.antialiased`.

nchunk : int >= 0, optional
If 0, no subdivision of the domain. Specify a positive integer to
divide the domain into subdomains of *nchunk* by *nchunk* quads.
Chunking reduces the maximum length of polygons generated by the
contouring algorithm which reduces the rendering workload passed
on to the backend and also requires slightly less RAM. It can
however introduce rendering artifacts at chunk boundaries depending
on the backend, the *antialiased* flag and value of *alpha*.
on to the backend and also requires slightly less RAM.

linewidths : float or array-like, default: :rc:`contour.linewidth`
*Only applies to* `.contour`.
Expand Down
4 changes: 1 addition & 3 deletions lib/matplotlib/pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3597,7 +3597,7 @@ def hexbin(
vmax: float | None = None,
alpha: float | None = None,
linewidths: float | None = None,
edgecolors: Literal["face", "none"] | ColorType = "face",
edgecolors: Literal["face", "none"] | ColorType = "none",
reduce_C_function: Callable[[np.ndarray | list[float]], float] = np.mean,
mincnt: int | None = None,
marginals: bool = False,
Expand Down Expand Up @@ -3917,7 +3917,6 @@ def pcolormesh(
vmax: float | tuple[float, ...] | None = None,
colorizer: Colorizer | None = None,
shading: Literal["flat", "nearest", "gouraud", "auto"] | None = None,
antialiased: bool = False,
data: DataParamType = None,
**kwargs,
) -> QuadMesh:
Expand All @@ -3930,7 +3929,6 @@ def pcolormesh(
vmax=vmax,
colorizer=colorizer,
shading=shading,
antialiased=antialiased,
**({"data": data} if data is not None else {}),
**kwargs,
)
Expand Down
5 changes: 0 additions & 5 deletions lib/matplotlib/tri/_tripcolor.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,6 @@ def tripcolor(ax, *args, alpha=1.0, norm=None, cmap=None, vmin=None,
kwargs['edgecolors'] = kwargs.pop('edgecolor')
ec = kwargs.setdefault('edgecolors', edgecolors)

if 'antialiased' in kwargs:
kwargs['antialiaseds'] = kwargs.pop('antialiased')
if 'antialiaseds' not in kwargs and ec.lower() == "none":
kwargs['antialiaseds'] = False

if shading == 'gouraud':
if facecolors is not None:
raise ValueError(
Expand Down