Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR removes cell_coloring_property from VoronoiGrid and sets it as an argument when visualizing.
Bug / Issue
Related to Minor refactoring of VoroinoiGrid #2437.
Implementation
In
voronoi.py
, there are three instances where thecell_coloring_property
attribute is mentioned. All of these instances should be commented out (but not deleted). By examiningmpl_space_drawing.py
, I found that this attribute is used to set the transparency (alpha
) of polygons. Based on the last line ofvoronoi.py
, I understand that the developer intended to set its value to0
. However, I don’t quite understand why it was defined as astr
, as indicated bycell_coloring_property: str | None = None
.To enable setting the transparency of Voronoi polygons during visualization, I modified
mpl_space_drawing.py
. In thedraw_voronoi_grid
function, I added this attribute as a new parameter. GPT and Claude suggested more refined approaches for this visualization, but I want to first confirm that my modification doesn’t introduce any bugs and hear your opinions on it.Testing
Using the
.pre-commit-config.yaml
file from the root folder of the Mesa project, I ranpre-commit run --all-files
locally, and all checks passed.Additional Notes
I just started learning Mesa and look forward to your suggestions. Thank you!