FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
matplotlib.github.com/2.0.0/users/colors-2.py at main · matplotlib/matplotlib.github.com · GitHub
matplotlib
/
matplotlib.github.com
Public
Notifications
You must be signed in to change notification settings
Fork
62
Star
29
Code
Issues
1
Pull requests
2
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
matplotlib.github.com
/
2.0.0
/
users
/
colors-2.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
30 lines (25 loc) · 895 Bytes
Breadcrumbs
matplotlib.github.com
/
2.0.0
/
users
/
colors-2.py
Copy path
File metadata and controls
30 lines (25 loc) · 895 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import
matplotlib
.
pyplot
as
plt
import
matplotlib
.
_color_data
as
mcd
import
matplotlib
.
patches
as
mpatch
overlap
=
{
name
for
name
in
mcd
.
CSS4_COLORS
if
"xkcd:"
+
name
in
mcd
.
XKCD_COLORS
}
fig
=
plt
.
figure
(
figsize
=
[
4.8
,
16
])
ax
=
fig
.
add_axes
([
0
,
0
,
1
,
1
])
for
j
,
n
in
enumerate
(
sorted
(
overlap
,
reverse
=
True
)):
weight
=
None
cn
=
mcd
.
CSS4_COLORS
[
n
]
xkcd
=
mcd
.
XKCD_COLORS
[
"xkcd:"
+
n
].
upper
()
if
cn
==
xkcd
:
weight
=
'bold'
r1
=
mpatch
.
Rectangle
((
0
,
j
),
1
,
1
,
color
=
cn
)
r2
=
mpatch
.
Rectangle
((
1
,
j
),
1
,
1
,
color
=
xkcd
)
txt
=
ax
.
text
(
2
,
j
+
.5
,
' '
+
n
,
va
=
'center'
,
fontsize
=
10
,
weight
=
weight
)
ax
.
add_patch
(
r1
)
ax
.
add_patch
(
r2
)
ax
.
axhline
(
j
,
color
=
'k'
)
ax
.
text
(
.5
,
j
+
1.5
,
'X11'
,
ha
=
'center'
,
va
=
'center'
)
ax
.
text
(
1.5
,
j
+
1.5
,
'xkcd'
,
ha
=
'center'
,
va
=
'center'
)
ax
.
set_xlim
(
0
,
3
)
ax
.
set_ylim
(
0
,
j
+
2
)
ax
.
axis
(
'off'
)
Back
|
FazBrowse Home
|
New Git URL