Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expand ax.scatter kwargs that can be used #2445

Merged
merged 9 commits into from
Oct 31, 2024

Conversation

quaquel
Copy link
Member

@quaquel quaquel commented Oct 30, 2024

#2430 added the possibility to pass keyword arguments on to the various draw functions. This builds on that by passing any keyword arguments not used explicitly in any of the draw functions on to ax.scatter. This can, for example, be used to set a custom colormap, control vmin, vmax etc., as shown in the updated Boltzmann wealth example (see below for a screenshot)

Screenshot 2024-10-30 at 20 02 09

Closes #1183.

Copy link

Performance benchmarks:

Model Size Init time [95% CI] Run time [95% CI]
BoltzmannWealth small 🔵 +1.8% [+1.0%, +2.5%] 🔵 -0.9% [-1.0%, -0.8%]
BoltzmannWealth large 🔵 +1.2% [+0.7%, +1.7%] 🔵 -1.7% [-2.2%, -1.2%]
Schelling small 🔴 +7.5% [+7.0%, +8.0%] 🔴 +12.8% [+12.4%, +13.2%]
Schelling large 🔴 +8.7% [+7.2%, +10.2%] 🔴 +22.3% [+20.3%, +23.8%]
WolfSheep small 🔴 +6.1% [+5.8%, +6.3%] 🔴 +4.1% [+4.0%, +4.3%]
WolfSheep large 🔴 +9.1% [+7.6%, +10.5%] 🔴 +13.1% [+10.0%, +16.3%]
BoidFlockers small 🔵 +2.9% [+2.4%, +3.4%] 🔵 +2.9% [+2.4%, +3.5%]
BoidFlockers large 🔵 +1.3% [+0.5%, +2.1%] 🔴 +4.2% [+3.8%, +4.5%]

Copy link
Member

@EwoutH EwoutH left a comment

Choose a reason for hiding this comment

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

It’s so incredibly nice to see examples updated together with code. And thanks for the screenshot, always appreciated!

Looks clean, let’s give others also a bit of time to review.

At some point we should add a note or section about handeling axes and their arguments (including things like colormapping) to the tutorial. Can be a follow up.

mesa/examples/basic/boltzmann_wealth_model/app.py Outdated Show resolved Hide resolved
@quaquel
Copy link
Member Author

quaquel commented Oct 30, 2024

If linewith and edgecolor are handled analogously to color and size, basically everything in ax.scatter is controllable and we can also close #2341. I might just do that in a seperate PR to keep this one clear and focussed.

@EwoutH
Copy link
Member

EwoutH commented Oct 30, 2024

I would say go ahead and merge tomorrow morning, our US-timezone friends can check tonight and otherwise it's good to go.

@EwoutH EwoutH added the enhancement Release notes label label Oct 31, 2024
@quaquel quaquel merged commit 1a29aa4 into projectmesa:main Oct 31, 2024
12 of 13 checks passed
@quaquel quaquel deleted the scatter_kwargs branch November 4, 2024 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Release notes label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Color gradient feature in agents portrayal is not documented properly
2 participants