Agent size change based on size of figure
If the number of agents in greater than 50, I use a linearly decreasing function to calculate the size of the agent. The lower limit for the agent size is 5.
Thank you for starting to work on this 👍
I have restructured the UI layout using some of the features by Solara. The sidebar can be minimised to expand the user view:
That looks nice. We could adaptively change the layout by detecting whether the Solara component is run in a Jupyter notebook or not: https://stackoverflow.com/questions/15411967/how-can-i-check-if-code-is-executed-in-the-ipython-notebook. But for this PR, you should focus on solving the grid render for #1806. The layout restyling should be in a separate PR.
I have now updated to change the size of the figure based on number of agents. This is possibly the easiest way. This avoids agent markers to come close as the number of users increase.
Changing the size of the markers itself does not look neat, although its possible.
Sure I can move future layout modifications to another PR.
To put it concisely:
- The marker size depends mainly on figure width and grid width, and nothing else. cell_width = figure_width / grid_width. Marker size should be adaptively scaled such that it is x% of cell width
- The figure size depends on screen width, and it is actually harder to detect screen width because it is a client-side information.
Thanks for the explaination, I can try this out. Meanwhile UI related changes is moved to PR #1825.
The change maintains the size of the agents based on size of the figure.
Really like this idea! What's needed to move this forward?
- Remove number of agents from the formula to calculate size. I have said several times that grid cell size has nothing to do with the number of agents. You can have a huge grid with sparse agents, and yet the agent marker still needs to be not bigger than the grid cell size
- https://github.com/projectmesa/mesa/pull/1825#discussion_r1349484373. Given that we haven't figured out a way to get screen size info to be sent to the Solara server, auto-scaling figure size needs to be removed for now.
- Print functions haven't been removed
Secondary reason for https://github.com/projectmesa/mesa/pull/1825#discussion_r1349484373 is that it is not thread safe. Anything that is global operation via plt.* is not thread safe.
@ankitk50 can we help you move this forward?
Superseded by #2049.