Skip to content

Commit 6968472

Browse files
Jammy2211Jammy2211
authored andcommitted
fix most of rectangular vciualization
1 parent e15aed0 commit 6968472

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

autoarray/plot/mat_plot/two_d.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -592,16 +592,16 @@ def _plot_rectangular_mapper(
592592
array=pixel_values.array, use_log10=self.use_log10
593593
)
594594

595-
edges_transformed = mapper.edges_transformed
595+
# Unpack edges (assuming shape is (N_edges, 2) → (y_edges, x_edges))
596+
y_edges, x_edges = mapper.edges_transformed.T # explicit, safe
596597

597-
edges_transformed_dense = np.moveaxis(
598-
np.stack(np.meshgrid(*edges_transformed.T)), 0, 2
599-
)
598+
# Build meshes with ij-indexing: (row = y, col = x)
599+
Y, X = np.meshgrid(y_edges, x_edges, indexing="ij")
600600

601601
plt.pcolormesh(
602-
edges_transformed_dense[..., 0],
603-
edges_transformed_dense[..., 1],
604-
pixel_values.array.reshape(shape_native),
602+
X, # x-grid
603+
Y, # y-grid
604+
np.flipud(pixel_values.array.reshape(shape_native)), # (ny, nx)
605605
shading="flat",
606606
norm=norm,
607607
cmap=self.cmap.cmap,

0 commit comments

Comments
 (0)