0

I'm trying to make a scatterplot of some data in matplotlib using:

ax.scatter(X, Y, Z, c='r', marker='0')

However, I'm getting the error below:

 Traceback (most recent call last):
    File "C:\Users\K\Desktop\3d", line 11, in <module>
    ax.scatter(X, Y, Z, c='r', marker='0')
    File "C:\Python27\ArcGIS10.1\lib\site-packages\mpl_toolkits\mplot3d\axes3d.py", line 2180, in scatter
    patches = Axes.scatter(self, xs, ys, s=s, c=c, *args, **kwargs)
    File "C:\Python27\ArcGIS10.1\lib\site-packages\matplotlib\axes.py", line 6296, in scatter
    marker_obj = mmarkers.MarkerStyle(marker)
    File "C:\Python27\ArcGIS10.1\lib\site-packages\matplotlib\markers.py", line 162, in __init__
    self.set_marker(marker)
    File "C:\Python27\ArcGIS10.1\lib\site-packages\matplotlib\markers.py", line 233, in set_marker
    Path(marker)
    File "C:\Python27\ArcGIS10.1\lib\site-packages\matplotlib\path.py", line 147, in __init__
    assert vertices.ndim == 2
    AssertionError

What am I missing? I can't see anything wrong.

1
  • 1
    Please show some minimal code to reproduce these errors if you want any help. Commented Jan 6, 2014 at 14:08

1 Answer 1

3

Your problem appears to be due to mistaking 0 for o.

Try ax.scatter(X, Y, Z, c='r', marker='o') (instead of marker='0').

If you pass in a maker that isn't one of matplotlib's marker codes, it assumes that you're passing in an array of vertices that can be converted into a path that can be used as a marker. Thus the somewhat cryptic error you're receiving.

If you want a literal 0 as the marker, use marker='$0$'. The dollar signs indicate a latex-formatted string, which matplotlib will use as the marker.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.