Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[ENH]: Colorbar should support location kwarg that sets both orientation and ticklocation #22676

Closed
@anntzer

Description

@anntzer

Problem

When colorbar autocreates an Axes, one can passlocation, which also sets the colorbar's orientation and the ticklocation (left for a left colorbar, right for a right colorbar, etc.). When one instead passes a manually created Axes (e.g. using inset_axes, as suggested by the colorbar_placement.py example), thelocation kwarg is not accepted (because things are directly passed to the Colorbar class); one needs to explicitly setorientation andticklocation (the latter is not even documented byFigure.colorbar):

frompylabimport*sfs=figure(layout="constrained").subfigures(1,2)ax=sfs[0].add_subplot()im=ax.imshow([[0,1], [2,3]])ax.figure.colorbar(im,location="top")ax=sfs[1].add_subplot()im=ax.imshow([[0,1], [2,3]])ax.figure.colorbar(im,cax=ax.inset_axes([0,1.05,1,0.05]),orientation="horizontal",ticklocation="top")show()

Proposed solution

Add alocation kwarg to the Colorbar constructor which sets bothorientation andticklocation, and is mutually exclusive with them.
... or at least better document the workaround.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp