I have some heavy plot and it's ok that it calculating couple seconds, but when i resize window/chart - its hang up for some time and that is not obviously behavior for me. How i can fix this? There is no changes in plot data, just resizing.
Demo:
import numpy as np
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
import matplotlib
matplotlib.use('GTKCairo')
from matplotlib.figure import Figure
from matplotlib.backends.backend_gtk3cairo import FigureCanvasGTK3Cairo as FigureCanvas
class MyApp:
def __init__(self):
self.Window = Gtk.Window()
graphFig = Figure()
graphCanvas = FigureCanvas(graphFig)
self.Window.add(graphCanvas)
# just example of heavy chart
subplot = graphFig.add_subplot(111)
for n in range(100):
x = np.arange(0, 100, 0.01)
y = np.sin(x) * n
subplot.plot(x, y)
return
def Run(self):
self.Window.show_all()
Gtk.main()
return
App = MyApp()
App.Run()
What options exist of fixing this issue? I wanna redraw chart only when its updated or when user pan/zoom it.