Skip to content

Tag: pyqtgraph

Generating Scatter Plot from a Matrix

I have a code that generates random matrices of 0’s and 1’s, and I’d like to convert these matrices into scatter plots, where the coordinate corresponds to the matrix row/column, and the color of the scatter point corresponds to the value (red if 0, blue if 1 for example). I’ve been ab…

matplotlib.pyplot.clim counterpart in pyqtgraph

I want to apply a colormap (“hot”) only to a certain range of values of an image. I already know this functionality from matplotlib.pyplot.clim where you have to specify a minimum and a maximum value for the scaling. As I understood it, you should use setLevels([min,max]) for this. I have included…

Hover Tool for plots in Pyqtgraph

I want to have data information shown when hovering over a line in pyqtgraph plots, but can’t get my sigpointsHovered to emit any signal. Here is a simple example of what i tried to do: I have already tried setting “hoverable” = True and read the docs several times, but I honestly have no cl…

pyqtgraph: How to add radiobuttons on a figure legend?

I want to control which curves are displayed at the figure by using the radiobuttons floating on the left-top corner, which will work also as a legend. How can I do that? Answer This could be achieved by inheiring pg.LegendItem and overriding addItem method. In it you need to create widgets and place them int…

How to move rect in pyqtgraph

I try to have a rect which moves with the mouse pointer. However, I seem to have a problem with calling the paint method. It either doesn’t draw or creates artifacts. The only clean picture I get is with a forced redraw (zoom the graph). Here’s my mwe Answer Just redrawing the contents of an inter…

finplot as a widget in layout

I am trying to add finplot, https://pypi.org/project/finplot/, as a widget to one of the layouts in my UI. I created a widget for finplot and added it to the widgets in the layout but I get the following error: Here is the code that I used. Answer The create_plot_widget() function creates a PlotItem that cann…