Skip to content

Axes3D scatter crashes without alpha keyword #6698

Closed
@kaufman

Description

@kaufman

version: 2.0.0b1+1773.g3590ce2
backend: gtkagg inside an ipython session

code snippet is:

from mpl_toolkits.mplot3d import Axes3D
clf()
ax = subplot(111, projection='3d')
l1 = ax.scatter([0,0.01,1],[0,0.01,1],[0,0.01,1], c='b')
# asc is a 93,3 numpy array of float128
# if required I can supply this data. 
Q = zip(*asc)
l2 = ax.scatter(Q[0],Q[1],Q[2], c='b')
#l2.set_alpha(0.5)
draw()

if alpha is not set for l2, then we crash. Visually there's lots of overlap in the l2 marker points. Notably l1 doesn't crash even without an alpha parameter, even though I do see overlap in the two close marker points.

Traceback (most recent call last):
  File "/Users/mcj/lib/python2.7/site-packages/matplotlib-2.0.0b1+1773.g3590ce2-py2.7-macosx-10.11-x86_64.egg/matplotlib/backends/backend_gtk.py", line 443, in expose_event
    self._render_figure(self._pixmap, w, h)
  File "/Users/mcj/lib/python2.7/site-packages/matplotlib-2.0.0b1+1773.g3590ce2-py2.7-macosx-10.11-x86_64.egg/matplotlib/backends/backend_gtkagg.py", line 87, in _render_figure
    FigureCanvasAgg.draw(self)
  File "/Users/mcj/lib/python2.7/site-packages/matplotlib-2.0.0b1+1773.g3590ce2-py2.7-macosx-10.11-x86_64.egg/matplotlib/backends/backend_agg.py", line 464, in draw
    self.figure.draw(self.renderer)
  File "/Users/mcj/lib/python2.7/site-packages/matplotlib-2.0.0b1+1773.g3590ce2-py2.7-macosx-10.11-x86_64.egg/matplotlib/artist.py", line 68, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "/Users/mcj/lib/python2.7/site-packages/matplotlib-2.0.0b1+1773.g3590ce2-py2.7-macosx-10.11-x86_64.egg/matplotlib/figure.py", line 1262, in draw
    renderer, self, dsu, self.suppressComposite)
  File "/Users/mcj/lib/python2.7/site-packages/matplotlib-2.0.0b1+1773.g3590ce2-py2.7-macosx-10.11-x86_64.egg/matplotlib/image.py", line 139, in _draw_list_compositing_images
    a.draw(renderer)
  File "/Users/mcj/lib/python2.7/site-packages/matplotlib-2.0.0b1+1773.g3590ce2-py2.7-macosx-10.11-x86_64.egg/mpl_toolkits/mplot3d/axes3d.py", line 272, in draw
    for col in self.collections]
  File "/Users/mcj/lib/python2.7/site-packages/matplotlib-2.0.0b1+1773.g3590ce2-py2.7-macosx-10.11-x86_64.egg/mpl_toolkits/mplot3d/art3d.py", line 460, in do_3d_projection
    fcs = mcolors.to_rgba_array(fcs, self._alpha)
  File "/Users/mcj/lib/python2.7/site-packages/matplotlib-2.0.0b1+1773.g3590ce2-py2.7-macosx-10.11-x86_64.egg/matplotlib/colors.py", line 227, in to_rgba_array
    result[i] = to_rgba(cc, alpha)
  File "/Users/mcj/lib/python2.7/site-packages/matplotlib-2.0.0b1+1773.g3590ce2-py2.7-macosx-10.11-x86_64.egg/matplotlib/colors.py", line 134, in to_rgba
    rgba = _to_rgba_no_colorcycle(c, alpha)
  File "/Users/mcj/lib/python2.7/site-packages/matplotlib-2.0.0b1+1773.g3590ce2-py2.7-macosx-10.11-x86_64.egg/matplotlib/colors.py", line 192, in _to_rgba_no_colorcycle
    raise ValueError("RGBA values should be within 0-1 range")
ValueError: RGBA values should be within 0-1 range

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions