Integrating Plotly inside WxPython - python

Plotly says it is a web library. Matplotlib does support Wxpython but comparatively, it is too low level. Is there any way to integrate Plotly inside a Wxpython GUI or are there any alternative for it?

You might be able to use Plotly's ability to export plots to images to get the plots into wxPython:
https://plot.ly/python/offline/#static-image-export
If you need the live plotting though, then you will need to use Webview:
https://wxpython.org/Phoenix/docs/html/wx.html2.WebView.html
I also see that Plotly can now be used offline, so if you used that plus Webview, it should work.

Wxpython webview doesn't support 3-d graphs from plotly.
For 3-d graphs, I used cefpython. It embeds a full chromium browser inside python application. wxpython example can be found here: https://github.com/cztomczak/cefpython/blob/master/examples/wxpython.py.
I used plotly offline, and read the file inside cefpython.

Related

Drawing on jupyter notebooks on DataSpell

I know this is "seeking for recommendations", but I have no experience with this.
I'm looking for a library for basic drawing in jupyter notebooks.
In particular I don't want libraries like plotly or matplotlib, since I don't need to draw graphs.
I'm looking for something like Canvas for JS.
I've already tested ipycanvas and tkinter but they don't work on DataSpell:
You can use the package turtle to produce drawings in Python.

Is there a way to open graphs in a new window in VSCode?

I'm graphing some stuff with matplotlib and I need to be able to zoom in on the graph. But VSCode just renders it in its Python Interactive window that I can't do anything with. Is there a way to open graphs in a their own window that allows for scaling and things?
I'm a developer on this extension. We don't currently support popping out graphs. If you want to vote up the issue, we have an issue filed for this support here:
https://github.com/Microsoft/vscode-python/issues/4976
Until this support is added there is a bit of a work around. You can manually use the %matplotlib ipython magic to update to non-inline rendering. Then when you show plots they will be shown in a popup window. Like so:
I can't tell you exactly what command to use as it might vary based on what you have installed in your environment. But %matplotlib auto or %matplotlib qt would be good places to try starting with.

Prefered 3-d plot library for WxPython

I am building a GUI application using Wxpython which requires 3-d scatter plots. I have tried using the following libraries but with shortcomings:
Matplotlib: Very slow rendering, panning and zooming needs workarounds.
plot.ly: I tried creating a wxpython webview and loading the plotly html from there, but wxpython webview does not seem to support WebGL which is required for 3d rendering. Have a look at this question for details.
mayavi: I am unable to figure how I can embed mayavi into wxpython GUI. This example at mayavi docs
just open a blank wx frame. Comments at this SO answer suggests that mayavi doesn't support Wxpython 4+.
Are there any 'decent' 3d-plotting libraries which support wxpython or is matplotlib my only option here?
[edit after comment]: The plot should be interactive(at least pan and zoom). The plot should preferably be inside a panel in wxpython. The data will be static.

How to draw a graph using python

I have a list of value need to be drawn. The problem is have a format. How can I draw a graph with this kind of value. Im using python 2.7 with wxPython.
This is the link to the value, I cannot paste it here because the format will change
The wxPython project has a separate demo package you can download and install. Get that and look at the PyPlot demo. It can most simple plots just fine. If you need something more powerful, go download matplotlib. They have an example on their website for integrating matplotlib with wxPython. There is also an article or two on the wxPython wiki about matplotlib.
you can use matplotlib
there's lot of examples how embedding matplotlib figure in wxpython

Can I use chart modules with wxpython?

Is it possible to use any chart modules with wxpython? And are there any good ones out there?
I'm thinking of the likes of PyCha (http://www.lorenzogil.com/projects/pycha/) or any equivalent. Many modules seem to require PyCairo, but I can't figure out if I can use those with my wxpython app.
My app has a notebook pane, and I'd like to place the chart inside it. The chart has to be dynamic -- ie the user can choose what kind of data to view -- so I'm guessing modules that make chart images are out.
Just for clarity, by charts I mean things like pies, lines and bars etc.
I recently revisited matplotlib, and am pretty happy with the results.
If you're on windows, there are windows installers available to make your installation process a little less painful.
One potential drawback though is that it requires numpy to be installed.
I don't have experience with the interactivity of it, but it does support event handling.
matplotlib does embed quite well in wxpython. I have only used it in Tkinter, which went smoothly for me. I like the optional toolbar that allows direct manipulation of the plot (resizing and panning and such)
Use matplotlib. It integrates nicely with wxPython. Here's a sample of an interactive chart with wxPython and matplotlib.

Categories