python - 'Type Error: Not implemented for this type' when trying to make a Scatter plot in matplotlib -
this first matplotlib program, sorry in advance if seems dumb question.
i'm trying setup basic serial connection between arduino , raspberry pi. planning on starting off simple, sending numbers rpi arduino board, having calculate (squaring in case) , sending numbers rpi plot values individually.
here arduino code:
void setup(){ serial.begin(9600); } void loop(){ if(serial.available() > 0){ int inc = serial.parseint(); inc = pow(inc,2); serial.println(inc); } } and here rpi code:
import serial ser = serial.serial('/dev/ttyacm0',9600) import matplotlib.pyplot plt plt.axis([0,20,0,400]) plt.ion() plt.show() in range(20): ser.write(str(i)) y=int(ser.readline()) plt.scatte([i],[y],'bo') plt.draw() everything seems work fine in loop, keep getting error message saying "type error: not implemented type" referring 'plt.draw()' function
any appreciated!
it because calling plt.scatter 'bo' inside.
the above works plt.plot !! i.e. specifying both marker style , colour together.
whereas plt.scatter should instead call way:
plt.scatter([i],[y],c='b',marker='o') this work!
Comments
Post a Comment