-
-
Save snsinfu/b79a5ca823a1b3e5f134d4a883561e76 to your computer and use it in GitHub Desktop.
[matplotlib] Add named colors (from prop cycle)
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
| plt.style.use("paper") | |
| # Name prop colors. You may need to change it to match your matplotlib style to use. | |
| names = ["nb:blue", "nb:red", "nb:green", "nb:yellow", "nb:cyan", "nb:purple", "nb:magenta", "nb:gray"] | |
| props = plt.rcParams["axes.prop_cycle"] | |
| assert len(names) == len(props) | |
| cc = plt.cm.colors.colorConverter | |
| for name, prop in zip(names, props): | |
| cc.colors[name] = prop["color"] | |
| cc.cache = {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment