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

contour edge case with all data below levels and a surrounding field of zeros #20203

Closed
@rcomer

Description

@rcomer

Bug report

Bug summary

If I attempt to make a contour plot with data that is entirely below the lowest level, and the data has a field of zeros around it, I get an unexpected contour between the zeros and anything positive.

Code for reproduction

importnumpyasnpimportmatplotlib.pyplotasplty=np.linspace(-10,10,20)x_2d,y_2d=np.meshgrid(y,y)data=np.cos(x_2d*np.pi/10.)+np.cos(y_2d*np.pi/10.)np.place(data,data<0.,0.)levels= [3,6]colors= ['b','r']plt.contour(data,levels=levels,colors=colors)plt.show()

Actual outcome

bug_zeros_line

Expected outcome

The plot should be blank, which is what happens if the call tonp.place is skipped.

Matplotlib version

  • Operating system: RHEL7.9
  • Matplotlib version (import matplotlib; print(matplotlib.__version__)): 3.4.1
  • Matplotlib backend (print(matplotlib.get_backend())): Qt5Agg
  • Python version: 3.8.8
  • Jupyter version (if applicable): N/A
  • Other libraries: numpy 1.20.2

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