Closed emprice closed 3 years ago
Hello @emprice! Thanks for opening this PR. We checked the lines you've touched for PEP 8 issues, and found:
cotengra/plot.py
:Line 456:80: E501 line too long (82 > 79 characters) Line 467:80: E501 line too long (82 > 79 characters)
Hi @jcmgray,
This is a completely frivolous request, but I really like using colormaps from the cmasher package, which provides way more colorblind-safe, publication-quality maps than matplotlib does natively. As written, your code expects strings and uses
getattr
to grab the associated colormap frommpl.cm
. All this PR does is put in a check that the input is not a colormap already before attempting that (could also check that it's a string?), and otherwise uses the input as-is. (IMHO, the more Pythonic solution would be for matplotlib to understand both strings and cmaps passed with thecmap
kwarg, but it does not.)I did a quick check, and I'm pretty sure this does nothing to affect the old behavior, it just adds the effect I've described.