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

[MNT]: Colormaps odd behavior (1 != 1.0) #28198

Open
@aaronshenhao

Description

@aaronshenhao

Summary

I encountered some unexpected behavior while usingnmatplotlib.colormaps. Apparently,a_colormap(1) outputs the wrong result. The color it produces is indistinguishable froma_colormap(0), although it is slightly different.a_colormap(1.0) produces the correct result, buta_colormap(1.0) != a_colormap(1).

What is going on? It would be useful to clarify this in thedocs.

Example

frommatplotlibimportcolors,colormapsimportmatplotlib.pyplotaspltprint(colors.to_hex(colormaps["binary"](0)),colors.to_hex(colormaps["binary"](1.0)))print(colors.to_hex(colormaps["binary"](0)),colors.to_hex(colormaps["binary"](1)))

Output

#ffffff #000000#ffffff #fefefe

Proposed fix

Improved documentation, or added consistency to make integer values work for the upper endpoint.

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