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

plot_surface with facecolors distorts colors due to default shading=True #30290

Open
@MisoNyang-i

Description

@MisoNyang-i

Summary

importnumpyasnpimportmatplotlib.pyplotaspltfrommatplotlibimportcmfrommatplotlib.colorsimportNormalizeX=np.linspace(0,1,100)Y=np.linspace(0,1,100)X_mesh,Y_mesh=np.meshgrid(X,Y)Z=np.cos((1-X_mesh)*np.pi)*np.cos((1-Y_mesh)*np.pi)*1e+14+1.4e+15Z_colors=np.cos(X_mesh*np.pi)norm=Normalize(vmin=np.min(Z_colors),vmax=np.max(Z_colors))colors=cm.gist_heat_r(norm(Z_colors))[:-1, :-1]fig=plt.figure()ax=fig.add_subplot(111,projection='3d')ax.plot_surface(X_mesh,Y_mesh,Z,facecolors=colors,edgecolor='none')plt.show()

Proposed fix

fig=plt.figure()ax=fig.add_subplot(111,projection='3d')ax.plot_surface(X_mesh,Y_mesh,Z,facecolors=colors,edgecolor='none',shade=False)plt.show()

When colors represent actual data values, shading-induced distortion is critical.

  1. Iffacecolors is explicitly given,shade=False should be the default behavior, since the user is already controlling the color manually.
  2. Alternatively, at minimum, this behavior should be clearly documented in theplot_surface API page, warning users that shading will distort manually specified facecolors.
  3. Or, provide an explicit warning if bothfacecolors andshade=True are used together.

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