<bdo id='GgqAP'></bdo><ul id='GgqAP'></ul>

    <legend id='GgqAP'><style id='GgqAP'><dir id='GgqAP'><q id='GgqAP'></q></dir></style></legend>
  • <small id='GgqAP'></small><noframes id='GgqAP'>

      <tfoot id='GgqAP'></tfoot>
    1. <i id='GgqAP'><tr id='GgqAP'><dt id='GgqAP'><q id='GgqAP'><span id='GgqAP'><b id='GgqAP'><form id='GgqAP'><ins id='GgqAP'></ins><ul id='GgqAP'></ul><sub id='GgqAP'></sub></form><legend id='GgqAP'></legend><bdo id='GgqAP'><pre id='GgqAP'><center id='GgqAP'></center></pre></bdo></b><th id='GgqAP'></th></span></q></dt></tr></i><div id='GgqAP'><tfoot id='GgqAP'></tfoot><dl id='GgqAP'><fieldset id='GgqAP'></fieldset></dl></div>
      1. Python Matplotlib 滑块已绘制但不移动或更新

        Python Matplotlib Slider is drawn but doesnt move or update(Python Matplotlib 滑块已绘制但不移动或更新)

          <bdo id='umCM0'></bdo><ul id='umCM0'></ul>

          <small id='umCM0'></small><noframes id='umCM0'>

          <i id='umCM0'><tr id='umCM0'><dt id='umCM0'><q id='umCM0'><span id='umCM0'><b id='umCM0'><form id='umCM0'><ins id='umCM0'></ins><ul id='umCM0'></ul><sub id='umCM0'></sub></form><legend id='umCM0'></legend><bdo id='umCM0'><pre id='umCM0'><center id='umCM0'></center></pre></bdo></b><th id='umCM0'></th></span></q></dt></tr></i><div id='umCM0'><tfoot id='umCM0'></tfoot><dl id='umCM0'><fieldset id='umCM0'></fieldset></dl></div>
              <tbody id='umCM0'></tbody>
          • <legend id='umCM0'><style id='umCM0'><dir id='umCM0'><q id='umCM0'></q></dir></style></legend>

              <tfoot id='umCM0'></tfoot>
                  本文介绍了Python Matplotlib 滑块已绘制但不移动或更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试绘制一个散点图,其中一个点根据滑块调整的参数移动.我需要参数是坐标列表中的位置.我有它,所以绘制了散点图,我可以通过更改位置手动移动点,但是当我尝试实现滑块时,它会显示出来,但不能用于更新绘图.任何帮助都会很棒.到目前为止我所拥有的如下.谢谢.

                  I am trying to draw a scatter plot with a point that moves based on a parameter adjusted by a slider. I need the parameter to be the position in a list of the coordinates. I have it so the scatter plot gets drawn and I can manually move the point by change the position, but when I try to implement the slider it is displayed, but can not be drug to update the plot. Any help would be great. What I have so far is below. Thanks.

                  %pylab
                  from mpl_toolkits.mplot3d import Axes3D
                  from matplotlib import animation
                  
                  def on_change(val):
                     p=int(val)/1
                  
                  def chart():
                      x=[0,0.5,1]
                      y=[0,0.5,1]
                      z=[0,0.5,1]
                      p=0
                      fig = pyplot.figure()
                      ax = fig.add_subplot(111, projection='3d')
                      ax.plot([0,0,0,0,0,1,1,0,0,1,1,1,1,1,1,0],[0,1,1,0,0,0,0,0,1,1,0,0,1,1,1,1],[0,0,1,1,0,0,1,1,1,1,1,0,0,1,0,0],c='black',zorder=10)
                      ax.scatter(x[p],y[p],z[p],zorder=0)
                      ax.set_xlabel('Width')
                      ax.set_ylabel('Depth')
                      ax.set_zlabel('Height')
                      slider_ax = plt.axes([0.15, 0.05, 0.7, 0.02])
                      slider = Slider(slider_ax, "min", 0, 2, valinit=1, color='blue')
                      pyplot.show()
                  
                  chart()
                  

                  推荐答案

                  您必须保留对 Slider 对象的引用,否则它(以及它的回调)会被垃圾收集.请参阅 https://github.com/matplotlib/matplotlib/issues/3105 上的长时间讨论.

                  You have to keep a reference to the Slider object around or it (and it's call backs) get garbage collected. See long discussion at https://github.com/matplotlib/matplotlib/issues/3105.

                  关于这方面的文档已在 1.4 中得到澄清.

                  The documentation on this has been clarified for 1.4.

                  这篇关于Python Matplotlib 滑块已绘制但不移动或更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Running .jl file from R or Python(从 R 或 Python 运行 .jl 文件)
                  Running Julia .jl file in python(在 python 中运行 Julia .jl 文件)
                  Using PIP in a Azure WebApp(在 Azure WebApp 中使用 PIP)
                  How to run python3.7 based flask web api on azure(如何在 azure 上运行基于 python3.7 的烧瓶 web api)
                  Azure Python Web App Internal Server Error(Azure Python Web 应用程序内部服务器错误)
                  Run python dlib library on azure app service(在 azure app 服务上运行 python dlib 库)
                  <i id='PH11f'><tr id='PH11f'><dt id='PH11f'><q id='PH11f'><span id='PH11f'><b id='PH11f'><form id='PH11f'><ins id='PH11f'></ins><ul id='PH11f'></ul><sub id='PH11f'></sub></form><legend id='PH11f'></legend><bdo id='PH11f'><pre id='PH11f'><center id='PH11f'></center></pre></bdo></b><th id='PH11f'></th></span></q></dt></tr></i><div id='PH11f'><tfoot id='PH11f'></tfoot><dl id='PH11f'><fieldset id='PH11f'></fieldset></dl></div>
                  <legend id='PH11f'><style id='PH11f'><dir id='PH11f'><q id='PH11f'></q></dir></style></legend>
                      <bdo id='PH11f'></bdo><ul id='PH11f'></ul>

                        <tbody id='PH11f'></tbody>

                        <small id='PH11f'></small><noframes id='PH11f'>

                        1. <tfoot id='PH11f'></tfoot>