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

Unhelpful ValueError raised when color array is incorrect format #15727

Closed
@TTitcombe

Description

@TTitcombe

Bug report

Bug summary
When colors passed to a plot are provided as tuples in the range[0, 255] instead of[0, 1], the error raised relates to the shape of the data (which is correct), not the values of the data.

Code for reproduction

importmatplotlib.pyplotaspltplt.scatter([0,1], [0,1],c=[(255,0,0), (0,255,0)])

Actual outcome

ValueError:'c'argumenthas2elements,whichisnotacceptableforusewith'x'withsize2,'y'withsize2.

Edit:

ValueError:RGBAvaluesshouldbewithin0-1range

is also raised, however it is less prominent than the "size" error, which should not be raised at all

Expected outcome
A single, specific error message:

ValueError:RGBAvaluesshouldbewithin0-1range

Matplotlib version

  • Operating system: Windows 10
  • Matplotlib version: 3.1.2
  • Matplotlib backend: Qt5Agg
  • Python version: 3.7.3

Installed matplotlib from conda

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