Skip to content

Add docs for NonUniformImage#2614

Open
j9ac9k wants to merge 1 commit intopyqtgraph:masterfrom
j9ac9k:add-non-uniform-image-to-docs
Open

Add docs for NonUniformImage#2614
j9ac9k wants to merge 1 commit intopyqtgraph:masterfrom
j9ac9k:add-non-uniform-image-to-docs

Conversation

@j9ac9k
Copy link
Copy Markdown
Member

@j9ac9k j9ac9k commented Feb 13, 2023

Recently realized that NonUniformImage didn't have an entry in our documentation. This PR aims to correct that, and also makes some minor changes to NonUniformImage as well.

@j9ac9k j9ac9k force-pushed the add-non-uniform-image-to-docs branch 5 times, most recently from 9928f64 to ea25303 Compare February 13, 2023 14:20
@j9ac9k j9ac9k force-pushed the add-non-uniform-image-to-docs branch 2 times, most recently from 9ba3a64 to 1595d8f Compare July 1, 2023 03:49
@j9ac9k j9ac9k force-pushed the add-non-uniform-image-to-docs branch from 1595d8f to 06e1d02 Compare July 8, 2023 17:09
@pijyoi
Copy link
Copy Markdown
Contributor

pijyoi commented Jul 9, 2023

Adapted example from
https://matplotlib.org/stable/gallery/images_contours_and_fields/image_nonuniform.html
to show that provided coords are not the drawn polygon centers

import pyqtgraph as pg
from pyqtgraph.graphicsItems.NonUniformImage import NonUniformImage

import numpy as np

pg.mkQApp()

pw = pg.PlotWidget()
pw.show()

# Linear x array for cell centers:
x = np.linspace(-4, 4, 9)
# Highly nonlinear x array:
x2 = x**3
y = np.linspace(-4, 4, 9)
z = np.sqrt(x[np.newaxis, :]**2 + y[:, np.newaxis]**2)

nuimg = NonUniformImage(x2, y, z)
nuimg.setColorMap(pg.colormap.get("Purples", source="matplotlib"))
pw.addItem(nuimg)

X, Y = np.meshgrid(x2, y, indexing='ij')
pdi = pg.PlotDataItem(X.ravel(), Y.ravel(), pen=None, symbol='x')
pw.addItem(pdi)

pg.exec()

The correct interpretation is that the provided coords are supposed to be the sampled data points, while the drawn polygons are shaded to the nearest coord's Z value.

@j9ac9k j9ac9k force-pushed the add-non-uniform-image-to-docs branch 2 times, most recently from 8559cfd to 446d61b Compare April 1, 2025 15:04
@j9ac9k j9ac9k marked this pull request as ready for review April 1, 2025 15:05
@j9ac9k j9ac9k force-pushed the add-non-uniform-image-to-docs branch from 446d61b to 72c0dd8 Compare April 1, 2025 15:10
@j9ac9k
Copy link
Copy Markdown
Member Author

j9ac9k commented Apr 1, 2025

still need to sort out edgecolor vs border

@j9ac9k j9ac9k force-pushed the add-non-uniform-image-to-docs branch 4 times, most recently from e2bda60 to 00a5914 Compare April 7, 2025 08:05
@j9ac9k j9ac9k force-pushed the add-non-uniform-image-to-docs branch from 00a5914 to dfeeb25 Compare April 7, 2025 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants