Skip to content

Shared lon/lat labels for rectangular map projections #79

Open
@mickaellalande

Description

@mickaellalande

I was trying to use shared labels, but I didn't succeed to make it work for longitude and latitude. At least if we write it as for other regular 2D data with x, y, as in the documentation example: https://proplot.readthedocs.io/en/latest/customizing.html#Shared-and-spanning-labels.

Here is an example (data: season_clim_diff.zip):

import xarray as xr
import proplot as plot

season_clim_diff = xr.open_dataarray('season_clim_diff.nc')

f, axs = plot.subplots(
    proj='cyl', proj_kw={'lon_0':180}, ncols=2, nrows=2, axwidth=3, share=3
)

seasons = ['DJF', 'MAM', 'JJA', 'SON']

for i, ax in enumerate(axs):
    m = ax.contourf(
        season_clim_diff.sel(season=seasons[i]), cmap='ColdHot', norm='midpoint'
    )
    ax.format(title=season_clim_diff.sel(season=seasons[i]).season.values)
    
f.colorbar(m, label="Snow Area Fraction [%]")
axs.format(
    geogridlinewidth=0.5, geogridcolor='gray8', geogridalpha=0.5, 
    labels=True, lonlines=60, latlines=30, 
    coast=True, ocean=True, oceancolor='gray4',
    suptitle="Annual snow cover bias (IPSL versus Rutgers)", 
    abc=True, abcstyle='a.'
)

proplot_subplots_share

Thus, with the share=3 option I would expect that the longitudes labels of the first line and the latitudes labels of the last column won't appear.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions