Skip to content

Cannot disable the right latitude labels of the gridlines #2607

@Bennett1998

Description

@Bennett1998

I am trying to plt the global map with the coordinate of Robinson, whereas the gl.right_labels = False cannot disable the latitude labels on the right side of the gridlines. The labels 60˚N and 60˚S still exists in the right side.
The cartopy 0.25.0, numpy 2.3.5, matplotlib 3.10.8 and python 3.14.0 are used.

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

fig = plt.figure(figsize=(10, 5), dpi=300)
lon_center = 0
map_proj = ccrs.Robinson(central_longitude=lon_center)
data_proj = ccrs.PlateCarree(central_longitude=lon_center)
ax = fig.add_subplot(1, 1, 1, projection=map_proj)
ax.coastlines(linewidth=0.3)

gl = ax.gridlines(draw_labels=True, linewidth=1, color='gray', alpha=0.5, linestyle='--')
gl.top_labels = False
gl.right_labels = False
Image

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