Skip to content

Axes3D scatter crashes without alpha keyword #6698

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
kaufman opened this issue Jul 6, 2016 · 5 comments
Closed

Axes3D scatter crashes without alpha keyword #6698

kaufman opened this issue Jul 6, 2016 · 5 comments
Milestone

Comments

@kaufman
Copy link
Contributor

kaufman commented Jul 6, 2016

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
@tacaswell tacaswell modified the milestones: 2.1 (next point release), 2.0 (style change major release) Jul 6, 2016
@tacaswell
Copy link
Member

I suspect someplace we have an alpha is None and the color conversion code expects an integer for alpha (and by suspect, I mean 'guess').

We either clean up all the places we may have invalid alphas or make the color conversion code a bit more permissive.

attn @anntzer

@anntzer
Copy link
Contributor

anntzer commented Jul 6, 2016

Can't reproduce with python2.7, matplotlib 2.0b1 (built from source) and gtkagg backend.

@kaufman
Copy link
Contributor Author

kaufman commented Jul 6, 2016

try with this data:
asc = loadtxt('data.txt', dtype=np.float128)

data.txt

@anntzer
Copy link
Contributor

anntzer commented Jul 6, 2016

OK, got it. It's actually something completely different, and due to mishandling of float128s (that was probably exposed by the new color conversion machinery). A PR is on its way.

@tacaswell tacaswell modified the milestones: 2.1 (next point release), 2.0 (style change major release) Jul 12, 2016
@tacaswell
Copy link
Member

Closed by #6700

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

No branches or pull requests

3 participants