I want to use matplotlib's imread/imshow feature on wxpython. What i want is not only image display but also plotting data on image. Is that possible on wxpython using WXAgg matplotlib?
I googled but couldn't find any example of it. Thanks in advance.
Related
I have several groups of data and I want to have a table to both visualize them and summarize some important features. What I want is something like the following:
The data are known and it is easy to get these features. But how to have a table (or whatever widget, as long as it shows like a table) to include both the small chart like a thumbnail (plotted by matplotlib)?
Is there a way I can use any Python GUI library (e.g., tkinter) to make it? I would appreciate any help! Thank you!
This image is created in Excel :(
We should be able to control the size of the chart so that it can "fit" the font of the text (data).
The borderlines are preferred but not required.
This is something you could use pyside/pyqt for. In pyqt all text labels can also be set as images, so you can just save your images from matplotlib and load them in PYQT. PYQT has an editor that generates your front end code, so I would recommend just downloading it and playing a bit with the editor. But PYQT is only good if you want a live GUI.
If you want to generate a file, just use excel like you are already doing with openpyxl (https://openpyxl.readthedocs.io/en/stable/)? I use it for a lot of my reports. With PIL you can add images from matplotlib.
At least some workaround would be appreciated. I am trying to save the figures as pdfs and then use it with latex as an animation. If there is a way to automatically add captions that will be really helpful as I am going to have about 50-60 figures.
I don't know if it is possible natively, but you can put the graph drawn by graph-tool in a matplotlib Figure() using the mplfig option in graph_draw(). With that you have access to all the flexibility of matplotlib around your graph.
I'm new to wxpython but have been a matplotlib user for some time now. I am developing a wxpython app in which I would like to have a simple frame with a single panel (actually, a wx.lib.plot.PlotCanvas instance). In the panel I want to show some data, which is in the form of a binary array (called imarr), like this one:
The array will always be of shape (64,N), and N can vary between about 400 and 1200 (I can sort out the panel sizing myself).
To do this in matplotlib I would use something like:
fig=figure(figsize=(12,2))
ax=fig.add_subplot(111)
ax.set_ylim(0,63)
ax.set_xlim(0,imarr.shape[0])
ax.set_aspect('equal')
matplotlib.imshow(imarr)
But I'm completely lost in wxpython. I have been looking into wx.lib.plot, but apart from the nice line and marker plotting capabilities, there doesn't seem to be an equivalent to imshow (or pcolor).
One (ugly) solution I have is to use matplotlib as above to create a png image and then use some wx magic to display the image on a panel (please set me straight if this won't be easy).
I'd much prefer to do it from within wxpython, for portability and general tidiness. Any advice on how to display a binary array on a wx.lib.plot.PlotCanvas (or a more generic wx.Panel) would be very useful!
Why don't you combine wxPython and matplotlib together? wx.lib.plot.PlotCanvas has limited functionality comparing to matplotlib. Have a look at an example in this answer and an example from the matplotlib documentation. Sorry that I didn't answer exactly what you are asking for but I think this is the right way to go.
I have a 2 part question:
what is the best method for plotting data in Python? I only need to plot data in 2d.
I have a canvas GUI that I built using Tkinter's canvas function. It draws an 8x8 grid of rectangles and also has some code to allow you to scroll the window. (I've attached a picture).
Is it possible to include a plot in the same window as this canvas object? I need to be able to display plotted data and hopefully add buttons to my GUI that will allow me to update the plot during the run of the GUI.
Thanks in advance!
Matplotlib is the de-facto way to plot data with Python. It's really wonderful. It can also be embedded in Tk.
I'm using Qt4.8 via PyQt in a Python application. Everything is working fine :-) But I need to present the user with some kind of curve editor, these widgets commonly found in image editing programs for adjusting contrast or color or stuff like this.
So I basically need a widget, which displays a curve with axes and stuff like that and the user should be able to "drop" points onto the curve and adjust the curve.
I thought I could use matplotlib for this, but as far as I see it doesn't provide any "editing" capability...
I wrote a Qt curve editor with OpenGL widget, you can try it.
http://www.shannap.com/qt-curve-editor-en.html
What you probably want is the qwt toolbox. It's like matplotlib for Qt.
http://qwt.sourceforge.net/
It has all kind of neat funcitonality for plots and graphs. Though you won't get the exact thing you need without creating your own subclasses.
You can do curve editor with matplotlib. See for example this YouTube video: http://www.youtube.com/watch?v=nCv_MhaeFo8
And then check the event handling examples: http://matplotlib.sourceforge.net/examples/event_handling/index.html