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

Should zero-sized Rectangles be taken into account for autoscaling purposes? #19081

Open
@anntzer

Description

@anntzer

Currently, Rectangles with zero-width and zero-height are ignored for autoscaling purposes, but not other zero-sized patches:

frommatplotlibimportpatches,pyplotaspltax=plt.figure().add_subplot()ax.add_patch(patches.Rectangle((-5,-5),0,0))# zero-sized at (-5, -5)ax.add_patch(patches.Circle((5,5),0))# zero-radius at (5, 5)ax.relim()ax.autoscale_view()plt.show()

results in axes autoscaled around (5, 5) (so they include the circle, but not the rectangle). I would argue that Rectangles should never be ignored, even if they have zero-width and zero-height, both for consistency with other patches, and because such Rectangles are likely not drawn with no reason.

This behavior (implemented inAxes._update_patch_limits) was introduced inf24d06c to support log-scaled histograms with empty bins, but is not necessary anymore as hist autoscaling was fully reworked in#14581, making this behavior unnecessary (the check in_update_patch_limits can be deleted with no bad effects); perhaps it was even already unnecessary before though.

Also, note that#2942 already weakened the original patch by going from ignoring Rectangles with zero width OR height to only ignoring Rectangles with zero width and height.

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


      [8]ページ先頭

      ©2009-2025 Movatter.jp