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() does not accept gray strings anymore #12429

Closed
Labels
API: argument checkingRelease criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Milestone
@gioelelm

Description

@gioelelm

Bug report

Bug summary

Passing a particula gray intensity as a string seems to be broken in matplotlib 3.0, at least for the scatter() function.
This kind of argument format should (and was) possible according to documentation.

Code for reproduction

plt.scatter(np.arange(10),np.arange(10),c="0.5")

Actual outcome

---------------------------------------------------------------------------IndexError                                Traceback (most recent call last)<ipython-input-99-426550bf20a7> in <module>()----> 1 plt.scatter(np.arange(10), np.arange(10), c="0.5")~/anaconda3/lib/python3.6/site-packages/matplotlib/pyplot.py in scatter(x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, data, **kwargs)   2791         x=x, y=y, s=s, c=c, marker=marker, cmap=cmap, norm=norm,   2792         vmin=vmin, vmax=vmax, alpha=alpha, linewidths=linewidths,-> 2793         verts=verts, edgecolors=edgecolors, data=data, **kwargs)   2794     sci(__ret)   2795     return __ret~/anaconda3/lib/python3.6/site-packages/matplotlib/__init__.py in inner(ax, data, *args, **kwargs)   1783                         "the Matplotlib list!)" % (label_namer, func.__name__),   1784                         RuntimeWarning, stacklevel=2)-> 1785             return func(ax, *args, **kwargs)   1786    1787         inner.__doc__ = _add_data_doc(inner.__doc__,~/anaconda3/lib/python3.6/site-packages/matplotlib/axes/_axes.py in scatter(self, x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, **kwargs)   4187             try:  # First, does 'c' look suitable for value-mapping?   4188                 c_array = np.asanyarray(c, dtype=float)-> 4189                 n_elem = c_array.shape[0]   4190                 if c_array.shape in xy_shape:   4191                     c = np.ma.ravel(c_array)IndexError: tuple index out of range

Expected outcome
same as:

plt.scatter(np.arange(10),np.arange(10),c=(0.5,0.5,0.5))

Matplotlib version

  • Operating system: Linux
  • Matplotlib version: 3.0
  • Matplotlib backend (print(matplotlib.get_backend())): notebook/inline
  • Python version: 3.6 (conda, default)

Metadata

Metadata

Assignees

No one assigned

    Labels

    API: argument checkingRelease criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp