-
Notifications
You must be signed in to change notification settings - Fork 63
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
color_brewer raises KeyError if user requests more colors than what the colormap has #104
Comments
ajabep
added a commit
to ajabep/branca
that referenced
this issue
Oct 3, 2022
The non-qualitative schemes should be extendable. This commit adds this feature. Fixes python-visualization#104 Fixes python-visualization#114 Moreover, the following error was not reported via issues and are fixed: * TypeError in the linear_gradient function when trying to extend any scheme. Indeed, in color_brewer, the key searched in the scheme database was not found, thus, it was passing `None` instead of a real scheme vector to linear_gradient; * The scheme 'viridis' was not in the base_codes JSON; * Multiple scheme hadn't any metadata in scheme_info JSON; * When a `n` value provided to `color_scheme` was a float, it tried to select an unknown scheme without raising the right Exception type.
Conengmo
pushed a commit
that referenced
this issue
Nov 7, 2022
* Fix a bunch of errors in `color_brewer` and add unit tests The non-qualitative schemes should be extendable. This commit adds this feature. Fixes #104 Fixes #114 Moreover, the following error was not reported via issues and are fixed: * TypeError in the linear_gradient function when trying to extend any scheme. Indeed, in color_brewer, the key searched in the scheme database was not found, thus, it was passing `None` instead of a real scheme vector to linear_gradient; * The scheme 'viridis' was not in the base_codes JSON; * Multiple scheme hadn't any metadata in scheme_info JSON; * When a `n` value provided to `color_scheme` was a float, it tried to select an unknown scheme without raising the right Exception type. * Fix deprecated `find_element_by_css_selector` Selenium just removed that method in version 4.3.0. See the CHANGES: https://github.com/SeleniumHQ/selenium/blob/a4995e2c096239b42c373f26498a6c9bb4f2b3e7/py/CHANGES * Fix a forgotten incrementation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem
branca.utilities.color_brewer
raises a non descriptive KeyError if the user requests more colors than the number of colors forming the selected colormap.For example,
RdYlBu
is made of 11 individual colors. If the user requests more than 11 colors using the parametern
, this will trigger this errorMinimal code
Other comments
This issue is linked to python-visualization/folium#1270
My understanding is that
color_brewer
is not meant to generate more colors than what is available. For that we can usebranca.utilities.linear_gradient
.However, there are two issues I can see with this behaviour:
The text was updated successfully, but these errors were encountered: