-
Notifications
You must be signed in to change notification settings - Fork 367
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
DOC: add example showing FeatureArtist is a ScalarMappable #2340
Conversation
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.
Looks good to me, a nice succinct example to demo it. Feel free to merge yourself with or without my minor suggestions.
|
||
# Plot the geometries coloured according to population estimate. | ||
art = ax.add_geometries(geometries, crs=ccrs.PlateCarree(), | ||
array=population_estimates, cmap='YlGnBu', norm='log') |
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.
Set a lower limit of 1 million to get a little more color variation?
array=population_estimates, cmap='YlGnBu', norm='log') | |
array=population_estimates, cmap='YlGnBu', norm='log', vmin=1e6) |
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.
The mappable won't take vmin so we have to pass it to the LogNorm
. I think that's OK and I had already been wondering about limiting the range, so 👍
-------------------------------- | ||
|
||
This example shows how to colour geometries based on a data array. This | ||
functionality is available since Cartopy 0.23. |
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.
Is there a way to do a .. since:
or something to automatically tag this with sphinx-gallery. I like that you put this in there to let people know when it came in!
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.
I don't know if there is but I am far from an expert in sphinx and sphinx-gallery. Over at matplotlib/matplotlib#27292 Hannah was advocating using sphinx tags for that sort of thing.
And the tests are broken again :-( |
The test failure seems to be coming from deep in owslib. Anyway it's clearly not caused by this PR so I'm going to merge. |
Rationale
Since #2323
FeatureArtist
is aScalarMappable
so we can colour geometries using a data array. I don't think this functionality is very discoverable so here is an example. Bikeshedding suggestions welcome!Implications