Updating to 6.9.1 breaks code which work under 6.9.0
-
I recently updated to 6.9.1. A heatmap I produce with pyqtgraph was no longer visible. When I deleted 6.9.1 and restored 6.9.0 the heatmap again worked even with updates to NumPy, pandas, and scikit-learn. Are others having problems with 6.9.1? Is a 6.9.1.1 coming?
-
Hi,
Are talking about PySide6 ?
How did you install it ?
Can you provide a minimal script and dependencies for people to reproduce this issue ? -
-
Yes I use PySide6 to create a 150 item GUI. Here's the code which produces a heatmap in 6.9.0 but shows just the axes in 6.9.1. I am trying to reproduce a heatmap I create with matplotib. It is still a work in process and requires some handstands in pyqtgraph such as an axis inversion. I've removed several failed attempts to rotate horizontal axis labels and failed attempts to place the colormap so that it aligns with the heatmap. Even with those removed it still has the problem with 6.9.1.
def plot_a_heatmap_using_pyqtgraph(self):
# Get data from director
distances_as_square = self._director.configuration_active.distances_as_squarenreferent = self._director.configuration_active.nreferent item_names = self._director.configuration_active.item_names item_labels = self._director.configuration_active.item_labels # Create lower triangle matrix like matplotlib distances_as_lower_triangle = np.triu(distances_as_square, k=0) # Create layout widget layout_widget = pg.GraphicsLayoutWidget() layout_widget.setBackground('w') # Create plot with title plot_item = pg.PlotItem(title='Inter-point Distances') plot_item.getViewBox().setDefaultPadding(0) # Create the image item for the heatmap and add it to the plot img = pg.ImageItem() plot_item.addItem(img) img.setImage(distances_as_lower_triangle) plot_item.invertY(True) img.setRect(pg.QtCore.QRectF(-0.5, -0.5, nreferent, nreferent)) # Set colormap cmap = pg.colormap.getFromMatplotlib('gist_yarg') img.setColorMap(cmap) # Configure axes plot_item.setLabel('left', "Items") x_axis = plot_item.getAxis('bottom') y_axis = plot_item.getAxis('left') # Set vertical axis labels y_axis.setTicks([[(i, name) for i, name in enumerate(item_names)]]) x_axis.setHeight(80) # Use item_labels for the bottom axis x_labels = [(i, item_labels[i]) for i in range(nreferent)] x_axis.setTicks([x_labels]) # Set view range for the matrix part only plot_item.getViewBox().setRange( xRange=(-0.5, nreferent-0.5), yRange=(-1.5, nreferent-0.5) ) # Get the current viewbox range vb = plot_item.vb x_min, x_max = vb.state['viewRange'][0] y_min, y_max = vb.state['viewRange'][1] # Add lines at top and right top_line = pg.InfiniteLine(pos=y_min, angle=0, pen='k') # horizontal right_line = pg.InfiniteLine(pos=x_max, angle=90, pen='k') # vertical # Link the lines to the ViewBox so they move with zoom/pan vb.addItem(top_line) vb.addItem(right_line) # Add the plot to the main layout layout_widget.addItem(plot_item, row=0, col=0) # Add colorbar colorbar = pg.ColorBarItem( values=(np.nanmin(distances_as_lower_triangle), np.nanmax(distances_as_lower_triangle)), colorMap=cmap, width=20, interactive=False ) colorbar.setImageItem(img) # Add colorbar to layout layout_widget.addItem(colorbar, row=0, col=1) layout_widget.ci.layout.setAlignment( colorbar, pg.QtCore.Qt.AlignVCenter) # Add extra space at the bottom for rotated labels layout_widget.ci.layout.setRowStretchFactor(0, 3) return layout_widget
-
There was a regression related to QGraphicsView in 6.9.1, https://bugreports.qt.io/browse/PYSIDE-3115 , this could be the reason. It will hopefully again work in 6.9.2.