Kivy matplotlib scatter plot scatter update

Viewed 91

I added a matplot scatter plot into kivy with success, see code below. With new incoming data in my application, I would like to change the position of the one existing scatter in the plot, how can I do that?

from kivy.garden.matplotlib.backend_kivyagg import FigureCanvasKivyAgg
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(projection='polar')
ax.set_theta_zero_location("N")
ax.set_theta_direction(-1)


N = 1
r = 2 * np.random.rand(N)
theta = 2 * np.pi * np.random.rand(N)
area = 200 * r**2
colors = theta

ax.scatter(theta, r, c=colors, s=area, cmap='hsv', alpha=0.75)

class MyApp(App):

    def build(self):
        box = BoxLayout()
        box.add_widget(FigureCanvasKivyAgg(plt.gcf()))
        return box

MyApp().run()

Thanks in advance.

0 Answers
Related