Skip to content

Conversation

@nvaytet
Copy link
Member

@nvaytet nvaytet commented Sep 8, 2025

Fixes #485

It is possible that the initial image has linspace coords (and thus rendered with imshow) and a subsequent update has non-linspace coords (should be rendered using pcolormesh).
Plopp is not really designed to swap artists in and out, so we merge the FastImage and MeshImage classes into a single one that handles both cases depending on linspace state.

self._xmin, self._xmax = self._bin_edge_coords["x"].values[[0, -1]]
self._ymin, self._ymax = self._bin_edge_coords["y"].values[[0, -1]]
self._dx = np.diff(self._bin_edge_coords["x"].values[:2])
self._dy = np.diff(self._bin_edge_coords["y"].values[:2])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, you wouldn't define attributes of self outside of __init__. And I don't like that these attrs only exist for the optimized mode.
Can you use composition to have a FastImage or MeshImage object inside Image? This might also get rid of the if self._optimized_mode: checks scattered everywhere.

@nvaytet nvaytet marked this pull request as draft September 10, 2025 10:19
@nvaytet
Copy link
Member Author

nvaytet commented Sep 10, 2025

I'm having second thoughts about this and #484. For the scatter3d plot it's leading to significant performance penalty...

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.

Image plot: coordinates/positions do not update

3 participants