繁体   English   中英

在不刷新页面的情况下重新加载 matplotlib plot 时出现错误

[英]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. slider 在生成新的 plot matplotlib 之前更改了 slice 编号会引发错误。

File "D:\Django_Projects\Django_Gliomai\BraTS\show.py", 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\deprecation.py", line 459, in wrapper
    return func(*args, **kwargs)
  File "D:\Django_Projects\Django_Gliomai\virtual_env\lib\site-packages\matplotlib\pyplot.py", line 2660, in imshow
    sci(__ret)
  File "D:\Django_Projects\Django_Gliomai\virtual_env\lib\site-packages\matplotlib\pyplot.py", line 3032, in sci
    return gca()._sci(im)
  File "D:\Django_Projects\Django_Gliomai\virtual_env\lib\site-packages\matplotlib\axes\_base.py", 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

我首先遇到了同样的问题。 通过本地化,发现问题可能是多线程造成的。 我说当线程数据改为1时,问题就不会再出现了。 因此,我推测问题的过程中有多个plot操作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM