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

Appearance settings

Hist color kwarg broken for multiple empty datasets #13002

Copy link
Copy link
@jluttine

Description

@jluttine
Issue body actions

Bug report

Bug summary

Histogram function color keyword argument is broken for multiple empty datasets.

Code for reproduction

plt.hist([[], []], color=["k", "r"])

Actual outcome

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-7-ea1bc187199f> in <module>()
----> 1 plt.hist([[], []], color=["k", "r"])

~/.miniconda/envs/leanheat/lib/python3.5/site-packages/matplotlib/pyplot.py in hist(x, bins, range, density, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, stacked, normed, hold, data, **kwargs)
   3130                       histtype=histtype, align=align, orientation=orientation,
   3131                       rwidth=rwidth, log=log, color=color, label=label,
-> 3132                       stacked=stacked, normed=normed, data=data, **kwargs)
   3133     finally:
   3134         ax._hold = washold

~/.miniconda/envs/leanheat/lib/python3.5/site-packages/matplotlib/__init__.py in inner(ax, *args, **kwargs)
   1853                         "the Matplotlib list!)" % (label_namer, func.__name__),
   1854                         RuntimeWarning, stacklevel=2)
-> 1855             return func(ax, *args, **kwargs)
   1856 
   1857         inner.__doc__ = _add_data_doc(inner.__doc__,

~/.miniconda/envs/leanheat/lib/python3.5/site-packages/matplotlib/axes/_axes.py in hist(***failed resolving arguments***)
   6502             color = mcolors.to_rgba_array(color)
   6503             if len(color) != nx:
-> 6504                 raise ValueError("color kwarg must have one color per dataset")
   6505 
   6506         # If bins are not specified either explicitly or via range,

ValueError: color kwarg must have one color per dataset

Expected outcome

Should work as plt.hist([[], []]) works.

Matplotlib version

  • Operating system: Linux (NixOS)
  • Matplotlib version: 2.2.2
  • Matplotlib backend (print(matplotlib.get_backend())):
  • Python version: 3.5
  • Jupyter version (if applicable):
  • Other libraries:

Installed matplotlib from default conda channel.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.