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

Y-labels shifted #1571

Closed
Closed
Assignees
pwuertz
@dopplershift

Description

@dopplershift

Y-labels on colorbars are no longer centered any more. This is readily seen by runningpylab_examples/contourf_demo.py. A git bisect shows the problem was caused byb9fba92.

This same commit has also resulted in shifted y-axis labels for axes created using the axes_grid toolkit. The easiest way to see this is to add y-axis labels to theaxes_grid/demo_axes_grid.py. Tweaking that demo as below shows both problems:

importmatplotlib.pyplotaspltfrommpl_toolkits.axes_grid1importAxesGriddefget_demo_image():importnumpyasnpfrommatplotlib.cbookimportget_sample_dataf=get_sample_data("axes_grid/bivariate_normal.npy",asfileobj=False)z=np.load(f)# z is a numpy array of 15x15returnz, (-3,4,-4,3)defdemo_grid_with_each_cbar(fig):"""    A grid of 2x2 images. Each image has its own colorbar.    """grid=AxesGrid(F,111,# similar to subplot(122)nrows_ncols= (2,2),axes_pad=0.1,label_mode="1",share_all=True,cbar_location="right",cbar_mode="each",cbar_size="7%",cbar_pad="2%",                    )Z,extent=get_demo_image()foriinrange(4):im=grid[i].imshow(Z,extent=extent,interpolation="nearest")grid.cbar_axes[i].colorbar(im)grid[2].set_ylabel('Long y label')grid.cbar_axes[3].set_ylabel('Long Cbar label')# This affects all axes because we set share_all = True.grid.axes_llc.set_xticks([-2,0,2])grid.axes_llc.set_yticks([-2,0,2])F=plt.figure(1, (5.5,2.5))F.subplots_adjust(left=0.05,right=0.98)demo_grid_with_each_cbar(F)plt.draw()plt.show()

The commit makes sense as causing the problem, but I'm not sure why.

Metadata

Metadata

Assignees

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


    [8]ページ先頭

    ©2009-2025 Movatter.jp