Skip to content

Colorbars within figures #377

@pratiman-91

Description

@pratiman-91

Description

Unable to produce colorbars within different subplots. Matplotlib is able to produce a better colorbar.

Steps to reproduce in Matplotlib

import matplotlib.pyplot as plt
import numpy as np

# Fixing random state for reproducibility
np.random.seed(19680801)

fig, axs = plt.subplots(3, 3, constrained_layout=True)
for ax in axs.flat:
    pcm = ax.pcolormesh(np.random.random((20, 20)))

fig.colorbar(pcm, ax=axs[0, :2], shrink=0.6, location='bottom')
fig.colorbar(pcm, ax=[axs[0, 2]], location='bottom')
fig.colorbar(pcm, ax=axs[1:, :], location='right', shrink=0.6)
fig.colorbar(pcm, ax=[axs[2, 1]], location='left')
plt.show()

Steps to reproduce in Proplot

import proplot as plt

fig, axs = plt.subplots(ncols=3, nrows=3)
for ax in axs:
    pcm = ax.pcolormesh(np.random.random((20, 20)))

fig.colorbar(pcm, ax=axs[0, :2], shrink=0.6, location='bottom')
fig.colorbar(pcm, ax=[axs[0, 2]], location='bottom')
fig.colorbar(pcm, ax=axs[1:, :], location='right', shrink=0.6)
fig.colorbar(pcm, ax=[axs[2, 1]], location='left')

Matplotlib behavior: [What you expected to happen]
Figure 2022-07-26 154238

Proplot behavior: [What actually happened]
Figure 2022-07-26 154247

Proplot version

3.4.3 Matplotlib
0.9.5 Proplot

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