Skip to content

[Bug]: segmentation error by using matplotlib.pyplot #30379

@ilja-schotte

Description

@ilja-schotte

Bug summary

By creating GeoAxes with pyplot.axes() and using .set_extent() or plt.show() i run into a segmentation error.

Code for reproduction

import matplotlib.pyplot as plt
import cartopy.crs as ccrs

print(f'backend used: {plt.get_backend()}')
ax = plt.axes(projection=projection=ccrs.NorthPolarStereo(central_longitude=10.0))
ax.set_extent([6.2, 14.6, 47.1, 55])

# following code also crashes with a segmentation fault:
fig, ax = plt.subplots(subplot_kw=dict(projection=ccrs.NorthPolarStereo(central_longitude=10.0)))
ax.coastlines()

plt.show()

Actual outcome

backend used: TkAgg
Segmentation fault (core dumped)

Expected outcome

no segmentation fault.

Additional information

Im using additionally
cartopy: 0.21.1
shapely: 2.1.1

it makes no difference if i use 'tkagg' or 'agg' as backend. I also testes shapely 1.8 and matplotlib 3.10.5 but noticed no changes in that behavior.
On another system (Ubuntu server minimized) with no GUI these scripts work as expected.

Operating system

Ubuntu 5.15.0-151-generic #161-Ubuntu

Matplotlib Version

3.7.1

Matplotlib Backend

tkagg

Python version

3.10.12

Jupyter version

No response

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions