问题标签 [matplotlib-widget]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
88 浏览

python - 网络中的 Matplot lib 图像属性(Django)

我想将图像输出到在 matplotlib 中创建的网络上,它具有与桌面上运行时相同的功能image.show(),例如缩放,更彻底地沿着绘图移动。

我已经检查了#stack 并得到了只提供静态图像或 gif 的旧帖子或matplotlib.animate()

我还查看了 matplotlib 小部件,但据我所知,这些小部件仅适用于桌面 GUI。

请分享一些关于如何实现它的经验或想法。

谢谢

0 投票
1 回答
1619 浏览

python - 如何在 PyQt 中使用按钮清除绘图?

我使用 QT Designer 在 PyQt 中创建了一个小 GUI。我有一个按钮。“清除”按钮必须清除此图(我的清除按钮调用 pushButton)。我尝试编写一些代码,但它不运行。如何创建这个清除按钮?谢谢你。

0 投票
1 回答
2137 浏览

python - 没有名为底图的模块

按照 此页面中的说明,我下载了底图及其依赖项。当我跑

sudo apt-get install python-mpltoolkits.basemap

它给了我以下输出:

同样的事情

sudo apt-get install python-matplotlib

但是在示例文件夹中运行 simpletest.py,会出现以下错误:

我还尝试了描述从源安装的同一页面的另一种方法,但输出相同。我在 ubuntu16.04 LTS 上运行。任何想法!

0 投票
1 回答
339 浏览

python-3.x - 来自 python 脚本的 Matplotlib 交互式小部件

我正在调整此示例以使用 的小部件与绘图进行交互matplotlib。我通常的工作方式是交互式的,spyder我只是从内部调用一个进行绘图的函数。我的目标是为尚未Python安装的用户提供可执行文件,因此作为中间步骤,我将函数包装到脚本中。我对独立脚本的经验很少,所以简而言之,我的看起来像这样:

所以我只是定义了绘图函数,然后调用它。我必须添加plt.show()命令,当我从 shell 工作时我不需要它IPython,否则执行:

不会产生任何东西。通过添加plt.show(),窗口将显示我在初始化部分中定义的图形。但是,没有交互发生。

像我这样运行脚本时实现交互的正确方法是什么?

0 投票
1 回答
1082 浏览

matplotlib - How to force redraw of a widget after changing some of its attributes?

Inside the call-back associated with a matplotlib.widgets.Slider instance, I want to modify the Slider valmin, valmax and val attributes, and then re-draw the Slider. When I try to re-draw it, nothing happens.

Before the call-back completes, I call plt.draw() and, while the rest of the plot is correctly updated, the Slider looks the same as before. I also tried calling draw() on the Axes of the Slider, and again no visible change.

How can I force a re-draw of the Slider instance after changing its attributes?

Thansk!

UPDATE

Here a small program that demonstrates the issue (with a crude dialog). The wanted behavior is that by clicking on a different value of the radio button, the slider changes range of values, current value and label. What happens instead is that when clicking on "Gradient" the slider stops responding (cannot be dragged anymore), and when clicking on "Gradient" or "Channel" the slider is not updated, in spite of a call to plt.draw()

0 投票
1 回答
48 浏览

python - matplotlib如何绘制不同间距的图形

matplotlib 如何绘制不同间距的图形?

具体来说,这个怎么画?

图片

0 投票
1 回答
37514 浏览

python - 使用 Qt Designer 表单和 PyQt5 在 QWidget 中绘制 matplotlib 图形

我不明白将 matplotlib 图形链接到从 Qt Designer 创建的表单的最佳方法。我有一个我在 QtDesigner 中创建的表单,然后通过 pyuic5 编译为 python。我的主要程序是:

其中 myApp 调用从 Qt Designer 创建的 app_framework.py 表单,然后由 pyuic5 (design.py) 转换:

我很困惑在这个框架中我可以将 matplotlib 图形链接到 QtDesigner 中的预制空小部件或类似的东西,这样我就可以在 GUI 窗口中绘制新数据(输入文本,按下按钮) , ETC。)

我在SOmatplotlib 的网站上找到了一些线程,但我不确定我是否理解在 Qt Designer 表单中为该小部件创建空间然后链接绘图和/或创建小部件事后的正确过程和然后链接和绘图。

到目前为止,我所做的是在 Qt Creator 中创建一个空的 QWidget,然后在 pyuic5 编译后,我将 design.py 文件更改如下:

然后 app_framework.py 为:

我认为这会起作用,但是当我单击绘图按钮时,什么也没有发生。它没有锁定,它只是不绘制任何东西。我猜我缺少在这个空小部件中绘制 matplotlib 图形和/或画布的基础知识。

0 投票
1 回答
338 浏览

python - 使用 Matplotlib Widget 同时绘制数据点和线

我试图在 Matplotlib 的同一轴上绘制一条线和数据点。当我尝试先绘制线时,数据点会被清除,当我尝试先绘制数据点时也是如此。这是最小的代码:

这是从 PYQT4 UI 文件创建的 python 代码。只需将其保存为 ui_sof_test.py:

0 投票
1 回答
2871 浏览

matplotlib - Matplotlib 中的透明导航栏(或者,可以在没有栏的情况下添加导航按钮吗?)

我正在尝试使用嵌入式 matplotlib 图最大限度地利用 Qt GUI 中的空间,包括标准的 matplotlib 导航栏,以为用户提供有用的功能(缩放、保存、移动等)

不幸的是,当绘图窗口具有“宽屏”比例时,导航栏最终会占用大量空间,如下所示。所有按钮都在左侧,但 NavigationBar 也会创建一整条空白区域。 在此处输入图像描述

虽然我的预期应用程序是在 Qt GUI 中嵌入 matplotlib 图,但我相信这是一个普遍问题,也可能适用于默认 matplotlib ax.plot 操作显示的标准图。

可以使用这个空间吗?我尝试在这里设置文本和 mpl 小部件,但它们总是隐藏在导航栏后面。也许有一个设置可以使这个栏的颜色透明?

或者,是否有一种快速方法可以将按钮作为小部件添加到我的图形上,因此不需要 NavigationBar。我喜欢该栏提供的样式和功能,因此不必手动重新实现每一个。

谢谢。

0 投票
1 回答
802 浏览

python - 基维!在多个屏幕上加载 matplot 图

我正在尝试从屏幕上的文件选择器加载图像,并尝试在我使用 Kivy_matplotlib 库的另一个屏幕中显示图像的 matplotlib 图这是代码

我被卡住了,因为我得到了以下回溯

需要帮助 在此先感谢