Skip to content

Commit 55d080b

Browse files
committed
Fix #34: ValueError in 2D histogram plotting with PyQt6
1 parent 3c59a11 commit 55d080b

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22

33
## Version 2.7.3 ##
44

5+
In this release, test coverage is 80%.
6+
57
🛠️ Bug fixes:
68

9+
* [Issue #34](https://github.com/PlotPyStack/PlotPy/issues/34) - `ValueError` when trying to plot 2D histogram items with `PyQt6`
10+
711
## Version 2.7.2 ##
812

913
🛠️ Bug fixes:

plotpy/items/image/misc.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
file=sys.stderr,
4040
)
4141
print(
42-
("try running :" "python setup.py build_ext --inplace -c mingw32"),
42+
("try running: python setup.py build_ext --inplace"),
4343
file=sys.stderr,
4444
)
4545
raise
@@ -340,7 +340,7 @@ def drawfunc(*args):
340340
return BaseImageItem.draw_image(self, *args)
341341

342342
if self.fill_canvas:
343-
x1, y1, x2, y2 = canvasRect.getCoords()
343+
x1, y1, x2, y2 = canvasRect.toAlignedRect().getCoords()
344344
drawfunc(painter, canvasRect, src_rect, (x1, y1, x2, y2), xMap, yMap)
345345
else:
346346
dst_rect = tuple([int(i) for i in dst_rect])

plotpy/tests/items/test_mandelbrot.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ def __init__(self, xmin, xmax, ymin, ymax):
4747

4848
# ---- QwtPlotItem API ------------------------------------------------------
4949
def draw_image(self, painter, canvasRect, srcRect, dstRect, xMap, yMap):
50-
x1, y1 = canvasRect.left(), canvasRect.top()
51-
x2, y2 = canvasRect.right(), canvasRect.bottom()
50+
x1, y1, x2, y2 = canvasRect.toAlignedRect().getCoords()
5251
i1, j1, i2, j2 = srcRect
5352

5453
NX = x2 - x1
@@ -58,7 +57,7 @@ def draw_image(self, painter, canvasRect, srcRect, dstRect, xMap, yMap):
5857
mandelbrot(i1, j1, i2, j2, self.data, self.IMAX)
5958

6059
srcRect = (0, 0, NX, NY)
61-
x1, y1, x2, y2 = canvasRect.getCoords()
60+
x1, y1, x2, y2 = canvasRect.toAlignedRect().getCoords()
6261
RawImageItem.draw_image(
6362
self, painter, canvasRect, srcRect, (x1, y1, x2, y2), xMap, yMap
6463
)

0 commit comments

Comments
 (0)