Open
Conversation
…otcheck into raster-legend-fix
…e the function shorter
lwasser
commented
May 2, 2020
| which element of all_label_options matches that entry. E.g. if the | ||
| first legend entry has a match in the first list in all_label_options, | ||
| then that legend entry corresponds to the first class (value 0). | ||
| Then the plot image array is copied and the values are set to the |
Author
There was a problem hiding this comment.
@nkorinek this is the part that you removed from the code that i want to add back - checking the data against the legend.
lwasser
commented
May 2, 2020
| for p in sublist | ||
| ]: | ||
| label = p.get_label().lower() | ||
| legend_dict[p.get_facecolor()] = self._which_label( |
Author
There was a problem hiding this comment.
i thijnk we can use this code to get both the label and the associated label color and add both to the dictionary that i created in check_label. this might require a slight restructure however but i thought we could implement this iteratively.
lwasser
commented
May 7, 2020
| # IMAGE TESTS/HELPER FUNCTIONS | ||
| return label_check | ||
|
|
||
| def get_plot_image(self): |
Author
There was a problem hiding this comment.
open to adding a parameter cmap=False
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
ok @nkorinek here is a start to cleanup this PR.
A few things we need
A plot with NO image on it
A plot with a double legend
plot that should pass and plots that should fail (right legend labels, wrong legend labels.
a plot with a raster and the legend is created manually so the patch color is WRONG for the associated label.
i've added a bunch of TODOs in the code where i'd like for you to double check docstrings and code to make sure it all works and is cleaned up. when the tests are done and things are cleaned up we can
Work on the final part. we want to test whether the array colors match the legend colors. I've started this by creating a dictionary where the key value is the plot label. We can add the RGB value for each patch to this dictionary . We then (i thijnk this will work but we shall see) will want to create a second dictionary that maps the color in the array to a value in the array. from there i think we can test whether the color red for example =1 = gain. if that doesnt' make sense we can chat more about it but i think it will work. you can grab the CMAP object from a image plot. i believe it do it in the make legend function in earthpy. then we can compare legends to data.
let's get the above working first and then we can add the image data check.