-
Notifications
You must be signed in to change notification settings - Fork 892
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
Add advanced customization options for agent visualization #2341
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
I like the API idea a lot. No time to review in detail atm. |
- Add support for edgecolors, linewidths, and alpha transparency in agent portrayal - Implement backward compatibility for old keyword arguments - Refactor _get_agent_data function to handle new visualization parameters - Update _draw_continuous_space and _draw_voronoi functions to use new agent data format - Improve code reusability and consistency across different space types Co-Authored-By: Robert Hopkins <[email protected]>
e6049fa
to
32aec47
Compare
I have to fix a few small things, but API wise it's ready. I rebased the PR on the latest main. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, I somehow missed this PR. Less code, more options sounds good!
Thanks! Only now I completely forgot what small things I still needed to fix 😅. |
|
||
return out | ||
"""Draw agents in a Voronoi space.""" | ||
agent_data = _get_agent_data(space, agent_portrayal) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work. This method is for plotting the experimental Voronoi space.
The _get_agent_data
method presupposes an old style space because it does for agents, pos in space.coord_iter():
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my remark about how this changes _draw_voronoi (which is a new style experimental space).
@EwoutH, with all the refactoring, how do you want to proceed with this? I had a quick look and have some ideas on how to provide this functionality within the refactored code-base. The tricky part is that |
I'm not attached to this PR at all. |
To be clear: support for alpha did not exist before #2430, which added The ax.scatter docs say:
but alpha array-like of float also works. I'll put in a new PR to support this. |
Interesting, notified them upstream: |
superseded by #2468 |
This PR builds on #2242 by @rmhopkins4.
This allows more visualisation options for agents, by allowing specifying
edgecolor
,linewidth
andalpha
in theagent_portrayal
.Implementation
_get_agent_data
function to handle new visualization parameters (edge colors, line widths, alpha)._draw_continuous_space
and_draw_voronoi
functions to use the new agent data format.Usage Examples
Users can now specify additional properties in their agent portrayal function. For example, display agents with red fill, black edges, and partial transparency.
Another example, dependent on the state of the Agent:
Additional notes