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

scalar categoricals are sometimes interpreted as data keys #9844

Open
@anntzer

Description

@anntzer

Bug report

Bug summary

Code for reproduction

frommatplotlibimportpyplotaspltfig,axs=plt.subplots(2)axs[0].bar("thing",1,data={"thing":1})axs[1].bar("other",1,data={"thing":1})plt.show()

Actual outcome

figure_1

The first plot's x-value ("thing") is interpreted as a lookup into the data dict and replaced by 1.
The second plot's x-value does not appear in the data dict and is interpreted as a categorical.

Expected outcome

Not sure what the best option is, but silently changing the interpretation of input based on whether it is present or not in another dict seems a bit finnicky. I have proposed in other places to not allow scalar categoricals at all (always need to be passed in a container -- list, array, dataframe, etc.), which also solves the inconsistency thatplot(1, "x") currently specs a marker whereasplot("x", 1) treats"x" as a categorical.

Unlike other categorical issues I don't actually think this is release critical per se, but it would still be nice to get the behavior clarified/simplified...

Matplotlib version

  • Operating system:
  • Matplotlib version: 2.1
  • Matplotlib backend (print(matplotlib.get_backend())):
  • Python version:
  • Jupyter version (if applicable):
  • Other libraries:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp