I would like to make a graph with different markers and different colors in accordance with the values ββof 2 external vectors.
Here is what I tried:
>>> s = [u'+', u'+', u'o'] >>> col = ['r','r','g'] >>> x = np.array([1,2,3]) >>> y = np.array([4,5,6]) >>> pl.scatter(x,y,marker=s,c=col) Traceback (most recent call last): File "/usr/lib/python3/dist-packages/matplotlib/markers.py", line 233, in set_marker Path(marker) File "/usr/lib/python3/dist-packages/matplotlib/path.py", line 133, in __init__ vertices = np.asarray(vertices, np.float_) File "/usr/lib/python3/dist-packages/numpy/core/numeric.py", line 460, in asarray return array(a, dtype, copy=False, order=order) ValueError: could not convert string to float: '+' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3/dist-packages/matplotlib/pyplot.py", line 3087, in scatter linewidths=linewidths, verts=verts, **kwargs) File "/usr/lib/python3/dist-packages/matplotlib/axes.py", line 6298, in scatter marker_obj = mmarkers.MarkerStyle(marker) File "/usr/lib/python3/dist-packages/matplotlib/markers.py", line 162, in __init__ self.set_marker(marker) File "/usr/lib/python3/dist-packages/matplotlib/markers.py", line 236, in set_marker raise ValueError('Unrecognized marker style {}'.format(marker)) ValueError: Unrecognized marker style ['+', '+', 'o'] >>>
EDIT: The proposed solution works on a simulated example, but it does not work on my real problem. (I do not know why).
Here is my full code:
import matplotlib.pyplot as pl import numpy as np locY = np.linspace(0, 1, 50)
If I replaced the building part with the suggested answer, I will get only 2 points in the plot (I donβt know why)
How can i decide?