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

Rectangle patch not transformed correctly in polar plot #8521

Open
@alexvorndran

Description

@alexvorndran

Bug summary
I added some rectangular patches to a polar plot and found that they are not transformed correctly if those patches are the only objects plotted. However, if there is any plot like a polar bar plot on the same figure, all patches on this and following figures are displayed correctly. As you can see in the code below, this behaviour can be observed even if the "other" plot is removed immediately.

Please note that this will only work on a "fresh" IPython/python console where no bar/scatter/... plot has been done on a polar axis, as all subsequent attempts will produce the correct result.

Code for reproduction

Puttingplt.show() at the very end of the script instead of where it is in the snippet does not lead to the error described above.

# -*- coding: utf-8 -*-importmathimportmatplotlib.pyplotaspltfrommatplotlibimportpatchesdefpolarbug(bar_hack=False):fig=plt.figure()ax=fig.add_subplot(111,projection='polar')# add quadrant as exampleax.add_patch(patches.Rectangle(            (0,1),width=math.pi*0.5,height=0.5        )    )ifbar_hack:ax.bar(0,1).remove()ax.set_rmax(2)plt.show()if__name__=='__main__':polarbug()polarbug(bar_hack=True)polarbug()

Actual outcome
With (left) and without (right)ax.set_rmax(2):
Figure 1
polarbug-1polarbug-1-w

Figure 2
polarbug-2polarbug-2-w

Figure 3
polarbug-3polarbug-3-w

Expected outcome
All three figures should look the same.

Matplotlib version

  • Operating System: Windows 10 Pro x64
  • Matplotlib Version: 2.0.0 (conda 4.3.16)
  • Python Version: 2.7.13 64bit
  • Other Libraries: math or numpy (for pi only)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp