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

3D scatterplots do not generate legend correctly #18096

Closed
Labels
@OGordon100

Description

@OGordon100

Bug report

Bug summary

Creating a 3d scatterplot with ax.scatter() and the "c" argument for colour only produces 1 legend entry

Code for reproduction

importnumpyasnpimportmatplotlib.pyplotaspltfig=plt.figure()ax=fig.add_subplot(111,projection='3d')x=np.random.rand(20)y=np.random.rand(20)z=np.random.rand(20)c=np.random.randint(low=0,high=4,size=20)ax.scatter(x,y,z,c=c)leg= [1,2,3,4]ax.legend(leg)

Actual outcome

Output Image

Expected outcome

The legend should have separate entries for "1", "2", "3", "4"

Matplotlib version

  • Operating system: Ubuntu 18.04
  • Matplotlib version: 3.3.0 (also exists at least as far back as 3.2.2)
  • Matplotlib backend (TkAgg):
  • Python version: 3.6.3
  • Jupyter version (if applicable): N/A
  • Other libraries: Numpy
pip

Metadata

Metadata

Assignees

No one assigned

    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