-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve cvt_archive_heatmap flexibility (#354)
## Description <!-- Provide a brief description of the PR's purpose here. --> This PR makes cvt_archive_heatmap more flexible by adding an `ec` parameter to control the edge color of the polygons. We also rearrange several existing arguments to more closely mirror `grid_archive_heatmap` — specifically, we move `plot_samples`, `plot_centroids`, and `ms` to the end of the argument list. This reordering should not break anyone since we require keyword arguments for this method by putting a `*` in the signature. Regarding style arguments for samples and centroids: I have decided to leave the sample and centroid style arguments (i.e., the arguments to `ax.plot`) as is for now, as it seems pretty rare to plot centroids/samples, so the added complexity of making them configurable may not be worth it. We can always add this later if there is a need for it. This PR also fixes several bugs encountered while making these API changes. ## TODO <!-- Notable points that this PR has either accomplished or will accomplish. --> - [x] Add ec parameter for controlling color of Voronoi cell boundaries - [x] Test style for Voronoi cells (`ec` and `lw`) - [x] Rearrange parameters to line up more closely with `grid_archive_heatmap` - [x] Make background color of empty cells be transparent — this is important when someone wants to save a transparent image — in this case, we don’t want the background to be white - [x] Throw an error if attempting to pass `plot_samples` when the archive has no samples - [x] Fix bug with division by zero error when `min_obj` and `max_obj` are identical — since we normalize by `max_obj - min_obj` , we were getting such errors if `min_obj` equaled `max_obj` ## Questions <!-- Any concerns or points of confusion? --> ## Status - [x] I have read the guidelines in [CONTRIBUTING.md](https://github.com/icaros-usc/pyribs/blob/master/CONTRIBUTING.md) - [x] I have formatted my code using `yapf` - [x] I have tested my code by running `pytest` - [x] I have linted my code with `pylint` - [x] I have added a one-line description of my change to the changelog in `HISTORY.md` - [x] This PR is ready to go
- Loading branch information
Showing
5 changed files
with
69 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+87.8 KB
...sualize/baseline_images/visualize_test/cvt_archive_heatmap_vmin_equals_vmax.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+109 KB
.../visualize/baseline_images/visualize_test/cvt_archive_heatmap_voronoi_style.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters