Getting Error while reloading the matplotlib plot without refreshing the page

I am trying to reload the matplotlib figure without refreshing the page and using Slider to change the slice number using django, matplotlib, mpld3, and javascript. The slider changes the slice number before generating the new plot matplotlib throws an error.

File "D:\Django_Projects\Django_Gliomai\BraTS\", line 25, in plot_1 plt.imshow(original[x,:,:,i], cmap='bone') File "D:\Django_Projects\Django_Gliomai\virtual_env\lib\site-packages\matplotlib_api\", line 459, in wrapper return func(*args, **kwargs) File "D:\Django_Projects\Django_Gliomai\virtual_env\lib\site-packages\matplotlib\", line 2660, in imshow sci(__ret) File "D:\Django_Projects\Django_Gliomai\virtual_env\lib\site-packages\matplotlib\", line 3032, in sci return gca()._sci(im) File "D:\Django_Projects\Django_Gliomai\virtual_env\lib\site-packages\matplotlib\", line 2155, in _sci raise ValueError("Argument must be an image, collection, or " ValueError: Argument must be an image, collection, or ContourSet in this Axes

I had the same problem first. Through localization, it is found that the problem may be caused by multithreading. I said that when the thread data is changed to 1, the problem will no longer occur. Therefore, I speculate that there are multiple plot operations in the process of the problem.

Back to Top