1

I've created a map with matplotlib-Basemap and will have an animated gif by drawing my special points / markers one by one in the plot. That work's fine. Now the markers should have a special color from a generated color-vector. In this vector are values from (0.0-1.0) for grey values. Problem: Passing the color vector to the plot command, cause this error:

raise ValueError('third arg must be a format string')

This is the important part of my code:

l, = m.plot([], [], [], marker='o', markersize=3)

xx=[]
yy=[]
ww=[]

for i in range(len(a)):
    xpt,ypt = m(long[i],lat[i])
    xx.append(xpt)
    yy.append(ypt)
    ww.append('0.55') # for a test the hole color vector is 0.55

data = np.vstack([xx,yy,ww])

def animate(num, data, point):
    point.set_data(data[0,:num],data[1,:num],data[2,:num])
    return point,

ani = animation.FuncAnimation(fig, animate, frames=len(data[1]), blit=True, fargs=(data,l), interval=500, repeat=False)

Any ideas?

1 Answer 1

1

the "plot" expects one or two vectors.

This works in your sample :

l, = m.plot([1,2,3], [3,4,5], marker='o', markersize=3)
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.