Skip to content

[Bug]: Crash in Windows 10 if polar axis lim is lower than lowest data point. #26765

@jrbrodie77

Description

@jrbrodie77

Bug summary

This example causes matplotlib to silently crash on Windows, but not on Mac. The example below is a minimal example. Looks like important detail is that the data extends below the radial axis minimum limit.

I have another bug related to log scale polar axes, these might be related:

#26485

Code for reproduction

import sys
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np



def plot():
    color_step = 3
    fontsize_y = 8

    # Create a polar plot
    fig = plt.figure(figsize=(10, 10))
    ax = fig.add_subplot(111, projection="polar")

    ax.set_rscale("log")

    # KEY LINE!!!!!!!!!!!1
    # Crashes in windows if lower limit is higher than lower datapoint.
    ax.set_rlim(101, 20000)

    n_angles = 3
    n_freqs = 10

    _angles = np.linspace(0, 180, n_angles)
    Angles = _angles[:, np.newaxis] * np.ones(n_freqs)


    # KEY LINE
    # Lower r_axis value is 100, which is lower than low axis limit.
    freqs = np.linspace(100, 1000, n_freqs)
    Freqs = np.ones((n_angles, 1)) * freqs[:, np.newaxis].T
    print(freqs)

    Mags = np.random.rand(*Freqs.shape) * 100


    colormesh = ax.pcolormesh(
        # Angle / 57.29,
        Angles / 57.29,
        Freqs,
        Mags,
        shading="gouraud",
#        cmap=colormap,
 #       vmin=color_lo,
  #      vmax=color_hi,
    )

    plt.show()

if __name__ == "__main__":
    plot()

Actual outcome

Plot window briefly shows, then disappears. I tried a couple version of Python and three backends. Crash occurs on plt.show or plt.savefig

Expected outcome

Plot displays. (works on Mac)

Additional information

No response

Operating system

No response

Matplotlib Version

3.7.3

Matplotlib Backend

QtAgg

Python version

3.8

Jupyter version

No response

Installation

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy