Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0d42553

Browse files
committed
MNT: use more explicit internal names + add comment
1 parent 1310015 commit 0d42553

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

lib/matplotlib/_color_data.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
'w': (1, 1, 1)}
1616

1717

18-
T10_COLORS = {
18+
# These colors are from Tableau
19+
TABLEAU_COLORS = {
1920
'blue': '#1f77b4',
2021
'orange': '#ff7f0e',
2122
'green': '#2ca02c',
@@ -29,7 +30,8 @@
2930

3031

3132
# Normalize name to "tc:<name>" to avoid name collisions.
32-
T10_COLORS = {'tc:' + name: value for name, value in T10_COLORS.items()}
33+
TABLEAU_COLORS = {'tc:' + name: value
34+
for name, value in TABLEAU_COLORS.items()}
3335

3436

3537
# This mapping of color names -> hex values is taken from

lib/matplotlib/colors.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
import numpy as np
6767
from numpy import ma
6868
import matplotlib.cbook as cbook
69-
from ._color_data import BASE_COLORS, T10_COLORS, CSS4_COLORS, XKCD_COLORS
69+
from ._color_data import BASE_COLORS, TABLEAU_COLORS, CSS4_COLORS, XKCD_COLORS
7070

7171

7272
class _ColorMapping(dict):
@@ -87,7 +87,7 @@ def __delitem__(self, key, value):
8787
# Set by reverse priority order.
8888
_colors_full_map.update(XKCD_COLORS)
8989
_colors_full_map.update(CSS4_COLORS)
90-
_colors_full_map.update(T10_COLORS)
90+
_colors_full_map.update(TABLEAU_COLORS)
9191
_colors_full_map.update(BASE_COLORS)
9292
_colors_full_map = _ColorMapping(_colors_full_map)
9393

@@ -254,7 +254,7 @@ def to_hex(c, keep_alpha=False):
254254
### Backwards-compatible color-conversion API
255255

256256
cnames = CSS4_COLORS
257-
COLOR_NAMES = {'xkcd': XKCD_COLORS, 'css4': CSS4_COLORS, 'tc': T10_COLORS}
257+
COLOR_NAMES = {'xkcd': XKCD_COLORS, 'css4': CSS4_COLORS, 'tc': TABLEAU_COLORS}
258258
hexColorPattern = re.compile("\A#[a-fA-F0-9]{6}\Z")
259259

260260

0 commit comments

Comments
 (0)