Skip to content

Feature request for colorbar support on geographic axes #678

@lwq-star

Description

@lwq-star

Hello,

I am using the Ultraplot library to create a 2×2 grid of subplots. The first row consists of geographic axes, while the second row contains regular (non-geographic) axes.

I created a colorbar for the geographic plots, but I would like to position the colorbar between the two rows of subplots, spanning across both columns.

However, in my attempts, the colorbar always appears below the first subplot instead of being centered between the two rows.

How can I correctly place the colorbar in the middle between the two rows and have it span across the columns?

This issue is similar to #392.

import ultraplot as uplt
import numpy as np

fig, axs = uplt.subplots(nrows=2, ncols=2, proj=["npstere", "npstere", None, None])

rng = np.random.default_rng()
data = rng.random((100, 100))

cm = axs[0, 0].pcolormesh(data)
fig.colorbar(cm, loc="b", ax=axs[0, :], span=(1, 2))
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions