Using wx and pyplot

Multi tool use


Using wx and pyplot
I've been building an application that uses both wx and matplotlib (pyplot) to show bar plots for relevant information. Part of the application's requirements is that we update the graph as we gather more data. I attempted to use pyplot in conjunction with wx but I learned that you can't natively call pyplot to "show()" due to the dependency overlap. I then tried to follow this example and along with explicitly stating the library for the graph UI (mpl.use('TkAgg')
) I also tried to use the matplotlib.figure.Figure
class to generate the graph in a matplotlib.backends.backend_wxagg.FigureCanvasWxAgg
. The biggest problem with this is that I can't have the graph in it's own separate window and I cannot specify the position that I want for this graph. Does anyone have any advice?
mpl.use('TkAgg')
matplotlib.figure.Figure
matplotlib.backends.backend_wxagg.FigureCanvasWxAgg
@Igor I'm using wxPython (
import wx
). As I understand it, wx and matplotlib both use the same kind of wx for graphical methods.I am working on macos. I installed it with homebrew– J S
yesterday
import wx
so you did get an error message when you tried to have both in your program? What the error said?
– Igor
yesterday
It is very unclear what your problem is. Is it totally feasible to embed a matplotlib plot in wx (see the official documentation). Provide some code that shows the problem that you are having and people will be able to help you
– Diziet Asahi
yesterday
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
are you using wxPython or wx' main line? What type of dependency overlap we are talking about? Under which OS you are working? How did you build wx?
– Igor
yesterday