Hi I'm new to this Site and appreciate your help. I have a variable resistor and it reads analog value and send to the python script. My objective is to plot this value using bubble plot which indicate the intensity by using radius of the circle. But I can not understand to clear the figure and update it. Your help will be highly appreciated.
import serial
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(19680801)
colors = np.random.rand(1)
plt.ion()
fig=plt.figure()
ser = serial.Serial('COM12',9600)
ser.close()
ser.open()
while True:
data = ser.readline()
y_val=int(data)
print(data.decode())
area = (10 * y_val) # 0 to 15 point radii
plt.scatter(5,10, s=area, c=colors, alpha=0.5)
i += 1
#plt.clf()
plt.show()
plt.pause(0.0001) # Note this correction