8000 3D scatter edgecolors='none' causes error · Issue #18242 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

3D scatter edgecolors='none' causes error #18242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kjohnsen opened this issue Aug 13, 2020 · 2 comments
Closed

3D scatter edgecolors='none' causes error #18242

kjohnsen opened this issue Aug 13, 2020 · 2 comments

Comments

@kjohnsen
Copy link

Bug report

Bug summary

Setting the edge color of markers on a 3D scatterplot apparently doesn't work.

Code for reproduction

import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.scatter([0, 1], [0, 1], [0, 1], c='b', edgecolors='none')
plt.show()

Actual outcome

ValueError                                Traceback (most recent call last)
~\.conda\envs\brian2genn\lib\site-packages\IPython\core\formatters.py in __call__(self, obj)
    339                 pass
    340             else:
--> 341                 return printer(obj)
    342             # Finally look for special method names
    343             method = get_real_method(obj, self.print_method)

~\.conda\envs\brian2genn\lib\site-packages\IPython\core\pylabtools.py in (fig)
    252         jpg_formatter.for_type(Figure, lambda fig: print_figure(fig, 'jpg', **kwargs))
    253     if 'svg' in formats:
--> 254         svg_formatter.for_type(Figure, lambda fig: print_figure(fig, 'svg', **kwargs))
    255     if 'pdf' in formats:
    256         pdf_formatter.for_type(Figure, lambda fig: print_figure(fig, 'pdf', **kwargs))

~\.conda\envs\brian2genn\lib\site-packages\IPython\core\pylabtools.py in print_figure(fig, fmt, bbox_inches, **kwargs)
    130         FigureCanvasBase(fig)
    131 
--> 132     fig.canvas.print_figure(bytes_io, **kw)
    133     data = bytes_io.getvalue()
    134     if fmt == 'svg':

~\.conda\envs\brian2genn\lib\site-packages\matplotlib\backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, **kwargs)
   2063                         orientation=orientation,
   2064                         dryrun=True,
-> 2065                         **kwargs)
   2066                     renderer = self.figure._cachedRenderer
   2067                     bbox_artists = kwargs.pop("bbox_extra_artists", None)

~\.conda\envs\brian2genn\lib\site-packages\matplotlib\backends\backend_svg.py in print_svg(self, filename, *args, **kwargs)
   1200                 detach = True
   1201 
-> 1202             result = self._print_svg(filename, fh, **kwargs)
   1203 
   1204             # Detach underlying stream from wrapper so that it remains open in

~\.conda\envs\brian2genn\lib\site-packages\matplotlib\backends\backend_svg.py in _print_svg(self, filename, fh, dpi, bbox_inches_restore, **kwargs)
   1225             bbox_inches_restore=bbox_inches_restore)
   1226 
-> 1227         self.figure.draw(renderer)
   1228         renderer.finalize()
   1229 

~\.conda\envs\brian2genn\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
     36                 renderer.start_filter()
     37 
---> 38             return draw(artist, renderer, *args, **kwargs)
     39         finally:
     40             if artist.get_agg_filter() is not None:

~\.conda\envs\brian2genn\lib\site-packages\matplotlib\figure.py in draw(self, renderer)
   1707             self.patch.draw(renderer)
   1708             mimage._draw_list_compositing_images(
-> 1709                 renderer, self, artists, self.suppressComposite)
   1710 
   1711             renderer.close_group('figure')

~\.conda\envs\brian2genn\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
    133     if not_composite or not has_images:
    134         for a in artists:
--> 135             a.draw(renderer)
    136     else:
    137         # Composite any adjacent images together

~\.conda\envs\brian2genn\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
     36                 renderer.start_filter()
     37 
---> 38             return draw(artist, renderer, *args, **kwargs)
     39         finally:
     40             if artist.get_agg_filter() is not None:

~\.conda\envs\brian2genn\lib\site-packages\mpl_toolkits\mplot3d\axes3d.py in draw(self, renderer)
    290                 sorted(self.collections,
    291                        key=lambda col: col.do_3d_projection(renderer),
--> 292                        reverse=True)):
    293             col.zorder = zorder_offset + i
    294         for i, patch in enumerate(

~\.conda\envs\brian2genn\lib\site-packages\mpl_toolkits\mplot3d\axes3d.py in (col)
    289         for i, col in enumerate(
    290                 sorted(self.collections,
--> 291                        key=lambda col: col.do_3d_projection(renderer),
    292                        reverse=True)):
    293             col.zorder = zorder_offset + i

~\.conda\envs\brian2genn\lib\site-packages\mpl_toolkits\mplot3d\art3d.py in do_3d_projection(self, renderer)
    543         self.set_facecolors(fcs)
    544 
--> 545         ecs = (_zalpha(self._edgecolor3d, vzs) if self._depthshade else
    546                self._edgecolor3d)
    547         ecs = mcolors.to_rgba_array(ecs, self._alpha)

~\.conda\envs\brian2genn\lib\site-packages\mpl_toolkits\mplot3d\art3d.py in _zalpha(colors, zs)
    845     norm = Normalize(min(zs), max(zs))
    846     sats = 1 - norm(zs) * 0.7
--> 847     rgba = np.broadcast_to(mcolors.to_rgba_array(colors), (len(zs), 4))
    848     return np.column_stack([rgba[:, :3], rgba[:, 3] * sats])
    849 

<__array_function__ internals> in broadcast_to(*args, **kwargs)

~\.conda\envs\brian2genn\lib\site-packages\numpy\lib\stride_tricks.py in broadcast_to(array, shape, subok)
    180            [1, 2, 3]])
    181     """
--> 182     return _broadcast_to(array, shape, subok=subok, readonly=True)
    183 
    184 

~\.conda\envs\brian2genn\lib\site-packages\numpy\lib\stride_tricks.py in _broadcast_to(array, shape, subok, readonly)
    125     it = np.nditer(
    126         (array,), flags=['multi_index', 'refs_ok', 'zerosize_ok'] + extras,
--> 127         op_flags=['readonly'], itershape=shape, order='C')
    128     with it:
    129         # never really has writebackifcopy semantics

ValueError: operands could not be broadcast together with remapped shapes [original->remapped]: (0,4) and requested shape (2,4)

Expected outcome

A 3D scatter plot where the markers don't have edge colors.

Matplotlib version

  • Operating system: Windows 10
  • Matplotlib version: 3.1.3
  • Matplotlib backend (print(matplotlib.get_backend())): module://ipykernel.pylab.backend_inline
  • Python version: 3.7.7
  • Jupyter version (if applicable): core=4.6.3, notebook=6.0.3
  • Other libraries:

I installed from pip, if I remember. There's a possibility it was from conda forge

@jklymak
9578 Copy link
Member
jklymak commented Aug 13, 2020

Thanks for the report. This is a duplicate of #18020.

@kjohnsen
Copy link
Author

Oh, I searched issues beforehand and didn't see that. Cool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants
0