Skip to content

How to centre the colorbar of a figure? #388

@donglx2018

Description

@donglx2018

Description

An inset colorbar can not centred.
The loc parameter has no centering option.

Steps to reproduce

A "Minimal, Complete and Verifiable Example" will make it much easier for maintainers to help you.

import proplot as pplt
import numpy as np

x = np.array([1,2,3,4,5,6])
y = np.array([1, 2])
data = [[np.nan,np.nan,np.nan,np.nan,np.nan,np.nan],[1,2,2,1,3,4]]


with pplt.rc.context({'cmap': 'Grays', 'cmap.levels': 21}):
    # Figure
    fig = pplt.figure(refwidth=2.3, share=False)
    axs = fig.subplots(ncols=1)
    axs.format(xlabel='xlabel', ylabel='ylabel',xlocator=1, ylocator=1, )
    hs=axs[0].pcolor( data, cmap='colorblind', levels=pplt.arange(0, 9,1))
    axs.colorbar(hs, loc='ll',length=12,) 

Expected behavior:
I want the colorbar in the figure to be centred.
Actual behavior:
image

Proplot version

matplotlib version is 3.3.4
proplot version is 0.9.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions