Skip to content

Axis sharing doesn't work for geo-axis #178

Closed
@zxdawn

Description

@zxdawn

Description

span and share don't work for geographic axis.

Steps to reproduce

import proplot as plot
f, axs = plot.subplots(nrows=2, ncols=2,
                       spany=3, sharey=3,
                       proj='lcc', proj_kw={'lon_0': 116}
                       )
axs.format(coast=True,
           latlines=1, lonlines=1,
           labels=True,
           lonlim=(113, 119),
           latlim=(37, 41.5),
           )

Expected behavior:
matplotlib_shareproj

Lat labels are shared.

Actual behavior:
cartopy_share

Equivalent steps in matplotlib

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

proj = ccrs.LambertConformal(central_longitude=116)
fig, axs = plt.subplots(nrows=2, ncols=2,
                        subplot_kw={'projection': proj})

for idx,ax in enumerate(axs.flatten()):
    ax.set_extent([113, 119, 37, 41.5], ccrs.PlateCarree())
    gl = ax.gridlines(crs=ccrs.PlateCarree(), draw_labels=True,
                      color='gray', alpha=0.5, linestyle='--',
                      x_inline=False, y_inline=False)
    gl.xlabels_top = False
    gl.ylabels_right = False
    if idx%2 != 0:
        gl.ylabels_left = False
    ax.coastlines()

Proplot version

0.6.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions