Skip to content

Conversation

@quaquel
Copy link
Member

@quaquel quaquel commented Jan 23, 2025

This closes #2635. Axes.imshow uses row, col, while our property layer data is x, y. This solves this by transposing the data in the axes.imshow command.

@github-actions
Copy link

Performance benchmarks:

Model Size Init time [95% CI] Run time [95% CI]
BoltzmannWealth small 🔵 +0.3% [-1.2%, +1.8%] 🔵 -0.4% [-0.9%, +0.0%]
BoltzmannWealth large 🔵 -1.0% [-1.5%, -0.5%] 🔵 +0.7% [+0.2%, +1.1%]
Schelling small 🔵 -0.5% [-0.8%, -0.2%] 🔵 -0.3% [-0.4%, -0.1%]
Schelling large 🔵 -2.9% [-6.6%, -0.9%] 🔵 +0.9% [-0.1%, +1.7%]
WolfSheep small 🔵 +0.1% [-0.2%, +0.3%] 🔵 +0.2% [+0.0%, +0.3%]
WolfSheep large 🔵 +0.3% [-0.1%, +0.6%] 🔵 -0.9% [-2.0%, +0.2%]
BoidFlockers small 🔵 -1.1% [-1.7%, -0.5%] 🔵 -0.2% [-0.4%, -0.1%]
BoidFlockers large 🔵 -1.8% [-2.2%, -1.3%] 🔵 -0.2% [-0.5%, +0.2%]

@EwoutH
Copy link
Member

EwoutH commented Jan 23, 2025

@Sahil-Chhoker since you put in the original issue, would you like to review?

@Sahil-Chhoker
Copy link
Collaborator

@EwoutH Sure, I would love to!


data = layer.data.astype(float) if layer.data.dtype == bool else layer.data
width, height = data.shape # if space is None else (space.width, space.height)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would suggest adding these two lines:

data = data.T
height, width = data.shape

Copy link
Member Author

Choose a reason for hiding this comment

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

I fixed your comments in a slightly different way but the effect is the same

@Sahil-Chhoker
Copy link
Collaborator

This was a fairly simple fix, @EwoutH this PR can be merged!

@EwoutH EwoutH added bug Release notes label visualisation labels Jan 23, 2025
@quaquel quaquel merged commit 13518b2 into projectmesa:main Jan 23, 2025
13 checks passed
@quaquel quaquel deleted the draw_property_layer branch January 23, 2025 10:46
tpike3 pushed a commit to tpike3/mesa that referenced this pull request Mar 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Release notes label visualisation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Property layer visualization doesn't work properly on rectangular grids.

3 participants