Select a region on the graph in tkinter - python

I wanted to use a graph on a canvas in tkinter, so I used matplotlib library (matplotlib.backends.tkagg and matplotlib.backends.backend_agg). Now, I want to select a region on the graph by creating a square using my mouse. In an empty canvas it’s possible, but unfortunately, there's no accessor for the pointer to the native renderer of tkagg graph.
Any idea about selecting a region on the graph in matplotlib/tkinter by creating a square using a mouse?

Related

Using vispy canvas within pyqtgaph viewbox

I am using pyqtgraph.ImageView to visualize data.
I need to smooth transition in my image with vispy like in this photo:
Do you know any way to get this kind of result with pyqtgraph or any way to integrate vispy canvas into pyqtgraph.ImageView?

Excessing Maps in python matplotlib graps

I am making a Tkinter based application in python which tracks the movement of users and plot them on a graph.
now ploting the points on a graph is no biggie, but what i couldnt manage was to give the background image as a map
currently my progress for this particular feature is nothing but as follows.
import matplotlib.pylab as plt
a=[[],[]]
a[0]=[12.28384,12,23434]#100's of values extracted from some csv file
a[1]=[80.12332,80.13312]#consider a[0],a[1] as latitude,longitude respectively
plt.plot(a[0],a[1])
plt.show()
This answer explains how to embed a map in a Tkinter window and may help.
You could also look at this example that uses the GooMPy library to embed an interactive google map in a Tkinter window.

PyQtGraph : how to change size (height and width) of graph in a ScrollArea

I'm trying to plot graph in a scroll area but I've no idea how to change the size of my graphs. Here is an example of what I have:
As you can see, in my ScrollArea (in Red) which as the size I want, I have a graph (well, in reallity I have more graphs and I want to see more then one (at least two) in this area).
So, I want the height of my graph (A) to be smaller and the width of my graph (B) to be expanding. Somine can help me ?
Thanks for your help !
It looks like your plot is inside a layout with the "Hide EMG" button. The widget holding that layout must be resized to fit the scroll area. You'll need to provide a code sample if you want more help than that..
Also consider using pg.MultiPlotWidget, which already provides similar functionality.
Adding to Lukes comment: A PlotWidget, which is probably what we see there, is a QGraphicsView, which is a QWidget. This is layed out using Qt. I'd recommend you to play a bit with Qt Designer to get an intuition on how the layouting works.
Another resource would be: https://doc.qt.io/qt-5/layout.html
For your explicit problem, if you do not want to get into Qt layouting, you could use QWidget.setMinimumHeight and QWidget.setMaximumHeight to confine the widget vertically. For the horizontal part, that totally depends on what you are doing there. If that was a grid layout, I'd refer to e.g.: Expanding only one column in a QGridLayout

Python, matplotlib, wxpython - Anyway to move an canvas from one frame to another?

So I don't really have any code to show as it's a very large script I have currently. Having said that I will try and add a simple example shortly.
Basically lets say I have two frames in wxpython, each containing a single panel with a matplotlib canvas. Lets call these canvases graph1 and graph2.
So I know how to plot directly into graph1, using standard methods.
I was wondering if there is any way I could change the location of graph1 into that of graph2, i.e. move the plot to the second frame (window).
Basically I am trying to implement a full screen option for the user, which upon clicking a graph will maximise it into the second frame. I am hoping I can do this just by changing the references rather than re-drawing etc. as I want it to keep the original state of the graph when it maximises.

Python Plotting and displaying multiple objects in same GUI window

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.

Categories