Skip to content

[Bug]: pcolormesh is not responsive in Matplotlib 3.5 #21917

Closed
@Hermeij

Description

@Hermeij

Bug summary

After updating to mpl 3.5.0 my program hangs after plotting with pcolormesh(), no error messages. It works fine witl mpl 3.3.3. When I reduce the nx,ny values in my program it works fine.

Code for reproduction

import numpy as np
    import matplotlib.pyplot as plt
    import cartopy.io.img_tiles as cimgt
    import cartopy.crs as ccrs

    fig, ax1 = plt.subplots(num="TestXX", figsize=(30/2.54, 25/2.54))
    
    #add a map of the Netherlands
    request = cimgt.OSM()
    ax1=plt.axes(projection=request.crs)
    ax1.set_extent([3.25, 7.35, 50.45, 53.55],ccrs.PlateCarree())
    ax1.add_image(request, 10)
    
    #create a rectangular grid a little smaller than the map
    #with cell sizes of 0.01 degree filled with random values
    nx=400
    ny=300
    xedges=np.linspace(3.3, 7.3, nx)
    yedges=np.linspace(50.5, 53.5, ny)
    zvalues=np.random.random((nx, ny))
    
    ax1.pcolormesh(xedges, yedges, zvalues.T ,\
                   alpha=0.3, shading='auto', transform=ccrs.PlateCarree())
        
    plt.show()

Actual outcome

Program hangs. Toolbar doesn't response. Hourglass is visible. No errors.
image

Expected outcome

Plot has been made. Toolbar works, normal running program.
image

Additional information

It worked fine with matplotlib 3.3.3. I can then increase nx,ny to 8000,6000.(I didn't try higher values)
It seems that there is a 'problem' with pcolormesh().
It works fine in mpl 3.5.0 with reduced nx,ny values(i.e. 100,75)

Operating system

Windows 10

Matplotlib Version

3.3.3 and 3.5.0

Matplotlib Backend

Qt5Agg

Python version

Python 3.8.12

Jupyter version

No response

Installation

conda

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions