Marker types in 3d plots

Marker types in 3d plots

Hi,

A few problems with marker types in 3D plots. I can use "o" and "^" and "+". However I can not use "." or "," it seems a bit odd to me however I get the below error. It should be possible to repeat this with the following input

Traceback (most recent call last):
   File "test.py", line 16, in <module>
     ax.scatter(xs, ys, zs, c=c, marker=m)
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mpl_toolkits/mplot3d/axes3d.py", line 1019, in scatter
     patches = Axes.scatter(self, xs, ys, *args, **kwargs)
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axes.py", line 5719, in scatter
     raise ValueError('Unknown marker symbol to scatter')
ValueError: Unknown marker symbol to scatter

···

----
import numpy as np
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt

def randrange(n, vmin, vmax):
     return (vmax-vmin)*np.random.rand(n) + vmin

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
n = 100
#for c, m, zl, zh in [('r', '+', -50, -25), ('b', '^', -30, -5)]:
for c, m, zl, zh in [('r', '+', -50, -25), ('b', '.', -30, -5)]:
     xs = randrange(n, 23, 32)
     ys = randrange(n, 0, 100)
     zs = randrange(n, zl, zh)
     ax.scatter(xs, ys, zs, c=c, marker=m)

ax.set_xlabel('X Label')
ax.set_ylabel('Y Label')
ax.set_zlabel('Z Label')

plt.show()

Right, there is only a subset of marker styles supported in the scatter function, both 2D and 3D. This is because, behind the scenes, it’s drawing all of the symbols as patches. See

http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.scatter

···

On Fri, Oct 15, 2010 at 10:43 AM, R. Bryn Fenwick <robert.fenwick@…2162…> wrote:

Marker types in 3d plots

Hi,

A few problems with marker types in 3D plots. I can use “o” and “^”

and “+”. However I can not use “.” or “,” it seems a bit odd to me

however I get the below error. It should be possible to repeat this

with the following input

Traceback (most recent call last):

File “test.py”, line 16, in

 ax.scatter(xs, ys, zs, c=c, marker=m)

File "/Library/Frameworks/Python.framework/Versions/2.6/lib/

python2.6/site-packages/mpl_toolkits/mplot3d/axes3d.py", line 1019, in

scatter

 patches = Axes.scatter(self, xs, ys, *args, **kwargs)

File "/Library/Frameworks/Python.framework/Versions/2.6/lib/

python2.6/site-packages/matplotlib/axes.py", line 5719, in scatter

 raise ValueError('Unknown marker symbol to scatter')

ValueError: Unknown marker symbol to scatter


import numpy as np

from mpl_toolkits.mplot3d import axes3d

import matplotlib.pyplot as plt

def randrange(n, vmin, vmax):

 return (vmax-vmin)*np.random.rand(n) + vmin

fig = plt.figure()

ax = fig.add_subplot(111, projection=‘3d’)

n = 100

#for c, m, zl, zh in [(‘r’, ‘+’, -50, -25), (‘b’, ‘^’, -30, -5)]:

for c, m, zl, zh in [(‘r’, ‘+’, -50, -25), (‘b’, ‘.’, -30, -5)]:

 xs = randrange(n, 23, 32)

 ys = randrange(n, 0, 100)

 zs = randrange(n, zl, zh)

 ax.scatter(xs, ys, zs, c=c, marker=m)

ax.set_xlabel(‘X Label’)

ax.set_ylabel(‘Y Label’)

ax.set_zlabel(‘Z Label’)

plt.show()


Download new Adobe® Flash® Builder™ 4

The new Adobe® Flex® 4 and Flash® Builder™ 4 (formerly

Flex® Builder™) enable the development of rich applications that run

across multiple browsers and platforms. Download your free trials today!

http://p.sf.net/sfu/adobe-dev2dev


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Daniel Hyams
dhyams@…287…