GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — mplot3d scatter should filter NaN values out · Issue #153 · matplotlib/matplotlib

mplot3d scatter should filter NaN values out #153

New issue
Copy link
New issue
Copy link
Closed
Closed
mplot3d scatter should filter NaN values out#153
Copy link
Labels
topic: mplot3d

Description

@ddale
ddale
opened on Jun 20, 2011
Issue body actions

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

    @WeatherGod
    WeatherGod
    on Jun 22, 2011
    Member
    More actions

    This appears to have been fixed. Closing...

  2. WeatherGod
    closed this as completedon Jun 22, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: mplot3d

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.