Skip to content

Something is wrong with axs 2D indexing for geographic plots #356

@kinyatoride

Description

@kinyatoride

I'm trying to plot lat labels on the first column and lon labels on the bottom row, but somehow it shows weird behavior. The same code worked with proplot.
Btw, thanks for maintaining this package. It's fantastic!

import numpy as np
import ultraplot as uplt

lon = np.arange(0, 360, 10)
lat = np.arange(-60, 60 + 1, 10)
state = np.random.RandomState(51423)
data = state.rand(len(lat), len(lon))

fig, axs = uplt.subplots(nrows=3, ncols=2, proj='cyl', share=0)
axs.format(coast=True)

for ax in axs:
    m = ax.pcolor(lon, lat, data)
    ax.colorbar(m)

axs[-1, :].format(lonlabels=True)
axs[:, 0].format(latlabels=True)
Image

It works with proplot:
Image

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions