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 could not raise when colors are provided but position data are empty #14113

Closed
Labels
Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Milestone
@mwaskom

Description

@mwaskom

The 3.0.x series added new checks inscatter for equivalence between the length of thex,y vectors and the length of thec vectors.

These changes have broken code in seaborn that sometimes calls scatter with empty position data but non-empty color data, e.g.

importmatplotlib.pyplotaspltf,ax=plt.subplots()ax.scatter([], [],c=["r","b","g"])
---------------------------------------------------------------------------ValueError                                Traceback (most recent call last)~/anaconda/envs/seaborn-dev/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)   4237                     valid_shape = False-> 4238                     raise ValueError   4239             except ValueError:ValueError: During handling of the above exception, another exception occurred:ValueError                                Traceback (most recent call last)<ipython-input-2-41dfae030a6e> in <module>()1import matplotlib.pyplotas plt2 f, ax= plt.subplots()----> 3 ax.scatter([], [], c=["r", "b", "g"])~/anaconda/envs/seaborn-dev/lib/python3.6/site-packages/matplotlib/__init__.py in inner(ax, data, *args, **kwargs)   1808                         "the Matplotlib list!)" % (label_namer, func.__name__),   1809                         RuntimeWarning, stacklevel=2)-> 1810             return func(ax, *args, **kwargs)   1811    1812         inner.__doc__ = _add_data_doc(inner.__doc__,~/anaconda/envs/seaborn-dev/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)   4243                         "acceptable for use with 'x' with size {xs}, "   4244                         "'y' with size {ys}."-> 4245                         .format(nc=n_elem, xs=x.size, ys=y.size)   4246                     )   4247                 # Both the mapping *and* the RGBA conversion failed: prettyValueError:'c' argument has 3 elements, which is not acceptable for use with 'x' with size 0, 'y' with size 0.

IMO this is an unnecessary exception because it conflicts with another patten in matplotlib, which is passing empty data along with specified style attributes (e.g. to create a proxy artist). I appreciate that thec parameter occupies a fuzzy zone between data and style attribute. But specifically in the case when the position data areempty, no points will have the wrong colors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Release 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