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

imshow() subplots with shared axes generate unwanted white spaces #1789

Closed
@rycmak

Description

@rycmak

When plotting two (or more) subplots which share the same axes, I see large areas of white spaces within the plots as seen here:
sharexImage

importmatplotlib.pyplotaspltimportnumpyasnpfig=plt.figure()ax=fig.add_subplot(2,1,1)ax.imshow(np.random.random((10,10)))ax.autoscale(False)ax2=fig.add_subplot(2,1,2,sharex=ax,sharey=ax)ax2.imshow(np.random.random((10,10)))ax2.autoscale(False)plt.show()

These white spaces persist even afterautoscale(False),ax.set_xlim(0, 10), and/orax.set_xbound(0, 10). One way to get rid of the white spaces is to setaspect=auto inimshow(), but this is not always ideal.
One could also set afigsize and manually adjust the axes to get the image contained exactly within the figure without white spaces, but resizing the figure would make the white spaces appear again.

Is there a way to correct for this behaviour?

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


      [8]ページ先頭

      ©2009-2025 Movatter.jp