FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

mplot3d scatter should filter NaN values out · Issue #153 · matplotlib/matplotlib · GitHub

Repository navigation

mplot3d scatter should filter NaN values out #153

Closed

Description

Original report at SourceForge, opened Thu Feb 25 16:02:13 2010

The 2D scatter plot ignores points that have NaN values. The 3D scatter plot should do the same to match the 2D functionality as closely as possible. Here is some test code to demonstrate:

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

xs = np.array([1, np.nan, 3])
ys = np.array([10, 20, 30])
zs = np.array([1, 2, 3])
cs = [(1,0,0,1), (0,1,0,1), (0,0,1,1)]

fig = plt.figure()
ax = fig.add_subplot(111)

ax.scatter(xs, ys, c=cs)

print '2D scatter OK'

fig = plt.figure()
ax = Axes3D(fig)

ax.scatter(xs, ys, zs, c=cs)

plt.show()

This is the exception that I get. The issue is that the zs, array has 3 values, when the xs and ys arrays only have 2. Because the NaN valued points are removed from the xs and ys arrays, but the zs array is untouched.

Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/local/lib/python2.6/lib-tk/Tkinter.py", line 1410, in call
return self.func(_args)
File "/usr/local/lib/python2.6/site-packages/matplotlib/backends/backend_tkagg.py", line 212, in resize
self.show()
File "/usr/local/lib/python2.6/site-packages/matplotlib/backends/backend_tkagg.py", line 215, in draw
FigureCanvasAgg.draw(self)
File "/usr/local/lib/python2.6/site-packages/matplotlib/backends/backend_agg.py", line 394, in draw
self.figure.draw(self.renderer)
File "/usr/local/lib/python2.6/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
draw(artist, renderer, *kl)
File "/usr/local/lib/python2.6/site-packages/matplotlib/figure.py", line 802, in draw
func(_args)
File "/usr/local/lib/python2.6/site-packages/mpl_toolkits/mplot3d/axes3d.py", line 152, in draw
for col in self.collections]
File "/usr/local/lib/python2.6/site-packages/mpl_toolkits/mplot3d/art3d.py", line 303, in do_3d_projection
vxs, vys, vzs, vis = proj3d.proj_transform_clip(xs, ys, zs, renderer.M)
File "/usr/local/lib/python2.6/site-packages/mpl_toolkits/mplot3d/proj3d.py", line 202, in proj_transform_clip
vec = vec_pad_ones(xs, ys, zs)
File "/usr/local/lib/python2.6/site-packages/mpl_toolkits/mplot3d/proj3d.py", line 184, in vec_pad_ones
vec = np.array([xs,ys,zs,np.ones((len(xs)))])
ValueError: setting an array element with a sequence.

SourceForge History

  • On Sun May 30 15:09:16 2010, by efiring: assigned_to: 100

Activity

  1. WeatherGod commented on Jun 22, 2011

    Member

    This appears to have been fixed. Closing...

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL