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

Scatter produce multiple colors for a single RGB/RGBA input #17423

Closed
Labels
Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.topic: color/color & colormaps
Milestone
@MaozGelbart

Description

@MaozGelbart

Bug report

Bug summary

Scatterdocs say that in order to provide a single RGB/RGBA color for all scatter elements, it is required to pass a 2D array with a single row forc argument input:

If you want to specify the same RGB or RGBA value for all points, use a 2-D array with a single row. Otherwise, value- matching will have precedence in case of a size matching with x and y.

When x/y shape is 3 and RGB is passed as a 2D array with a single row (e.g.c=[[1, 0.5, 0.05]]), or when x/y shape is 4 and RGBA is passed as a 2D array with a single row, the plot elements have several different colors (taken from the default colormap?) while all should have the same color. The problem occurs for bothplt.scatter andax.scatter calls, and also ifc input is provided as a numpy array of shape (1,3) for RGB or (1,4) for RGBA instead of a nested list.

Code for reproduction

importmatplotlib.pyplotaspltplt.scatter(range(3),range(3),c=[[1,0.5,0.05]])#alternatively, for RGBA scenarioplt.scatter(range(4),range(4),c=[[1,0.5,0.05,1]])

Actual outcome
840-mpl

Expected outcome
All points have the same color: RGB (1, 0.5, 0.05).

Matplotlib version

  • Operating system: Linux
  • Matplotlib version: 3.2.1
  • Matplotlib backend (print(matplotlib.get_backend())): agg
  • Python version: 3.7.3

Matplotlib installed through pip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.topic: color/color & colormaps

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp