Skip to content

GeoAxes features request #397

@Dearsomeone

Description

@Dearsomeone

Description

Hello, I am a regular user of proplot with which I can draw beautiful geoscience plots. CartesianAxes provides powerful contol on axes major and minor ticks. But for GeoAxes, it seems that proplot only provides control of lat and lon grid lines. If I want to show lat and lon ticks for NCL style geographic plots, I can only call the matplotlib method ax.tick_params(). As shown below, the code will become redundant and inconsistent with the proplot style. If the GeoAxes.format can control the lat and lon ticks, I think it will be a nice feature.

Steps to reproduce

# your code here
# we should be able to copy-paste this into python and exactly reproduce your bug
import proplot as pplt
import cartopy.crs as ccrs
import matplotlib.ticker as ticker
from cartopy.mpl.ticker import LongitudeFormatter, LatitudeFormatter

fig = pplt.figure(refwidth=5)

axs = fig.subplots(nrows=1, ncols=1, proj="cyl", proj_kw={"lon_0": 200}, right="3em")

axs.format(
    suptitle="Figure with NCL sytle by matplotlib",
    suptitlesize=12,
    suptitlepad=10,
    land=True,
    landcolor="k",
    coast=True,
    coastlinewidth=1,
    reso="lo",
    latlim=(-90, 90),
    lonlim=(0, 360),
    grid=False,
)


axs.set_xticks(np.arange(0, 381, 60), crs=ccrs.PlateCarree())
axs.set_yticks(np.arange(-90, 91, 30), crs=ccrs.PlateCarree())


lon_formatter = LongitudeFormatter(zero_direction_label=False)
lat_formatter = LatitudeFormatter()
axs.xaxis.set_major_formatter(lon_formatter)
axs.yaxis.set_major_formatter(lat_formatter)

axs.xaxis.set_tick_params(labelsize=10, pad=5)
axs.yaxis.set_tick_params(labelsize=10, pad=5)

axs.xaxis.set_minor_locator(ticker.IndexLocator(base=30, offset=10))
axs.yaxis.set_minor_locator(ticker.MultipleLocator(15))

axs.tick_params(
    which="major",
    direction="out",
    length=10,
    width=1.5,
    colors="k",
    top="on",
    bottom="on",
    left="on",
    right="on",
)

axs.tick_params(
    which="minor",
    direction="out",
    length=5,
    width=0.8,
    top="on",
    bottom="on",
    left="on",
    right="on",
)

axs.grid(False)

Expected behavior:
image

Proplot version

matplotlib.version = 3.2.2
proplot.version = 0.9.5

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