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
Error when color value is None #4192
Comments
The intended behavior is that the None object is not supported; it should always be a string. |
Then should |
Yes. The None object can be used as a kwarg in a function call to indicate that the default should be used. In that case, it is the function's responsibility to find the default in rcParams and use it to replace the None object with a valid color specification (string or tuple) before it goes any farther. |
@tacaswell The relevant PR is #3792, which you merged as 92e608d. It looks like this needs to be redesigned. The None object should not be a valid rcParams entry, and this PR relies on it; in the process of doing so, it wrecks the ability to use 'none' as a color spec in rcParams. |
I see the problem. How do we want to deal with optional rcparams?
If we don't let those two new rcparams be None, we break back compatibility
as we change what rcparams parts of the legend look at.
I think adding a new validator color_or_none for these cases and restore
the old color validation.
|
Things will be broken no matter what we do; the new validator approach would not allow the 'none' color spec to be used in this location. The basic problem is that this was an attempt to introduce a forwarding functionality without putting in a proper mechanism for it. The good thing is that this is only in master, not in color_overhaul, so I think that we can simply revert most of it, and no one will have a problem. We can leave in the new kwargs, but leave out the forwarding (or alias, or whatever it should be called) until we have a suitable mechanism for it. Perhaps it could be handled with a new keyword and a new validator, as an ad-hoc way of managing a small number of such cases. |
Possible fix for matplotlib#4192. This adds a new validation (validate_color_or_None) method for color which allows None and restores `validate_color` to fail on None. This will allow selected color rcparams to be `None` (not `'None'`) which the library should interpret as "don't use this rcparam".
Possible fix for matplotlib#4192. This adds a new validation (validate_color_or_None) method for color which allows None and restores `validate_color` to fail on None. This will allow selected color rcparams to be `None` (not `'None'`) which the library should interpret as "don't use this rcparam".
Possible fix for matplotlib#4192. This adds a new validation (validate_color_or_None) method for color which allows None and restores `validate_color` to fail on None. This will allow selected color rcparams to be `None` (not `'None'`) which the library should interpret as "don't use this rcparam".
Possible fix for matplotlib#4192. This adds a new validation (validate_color_or_None) method for color which allows None and restores `validate_color` to fail on None. This will allow selected color rcparams to be `None` (not `'None'`) which the library should interpret as "don't use this rcparam".
Possible fix for matplotlib#4192. This adds a new validation (validate_color_or_None) method for color which allows None and restores `validate_color` to fail on None. This will allow selected color rcparams to be `None` (not `'None'`) which the library should interpret as "don't use this rcparam".
Possible fix for matplotlib#4192. This adds a new validation (validate_color_or_None) method for color which allows None and restores `validate_color` to fail on None. This will allow selected color rcparams to be `None` (not `'None'`) which the library should interpret as "don't use this rcparam".
Closed by #4193 |
Commit d58a84a changed
validate_colors
so that value inrcParams
isNone
rather than "None". However, in some cases, it seems that a string is still expected downstream.For example,
results in
This particular error can be fixed with
A few other places also seem to expect a string.
Should these cases be updated to support
None
? I'd be happy to submit a PR, but I'm not clear on what the intended behavior is.The text was updated successfully, but these errors were encountered: