Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitab990e4

Browse files
committed
FIX: No title [skip actions] [skip azp]
1 parent2a07400 commitab990e4

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

‎examples/color/named_colors.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,12 @@
2222
importmatplotlib.colorsasmcolors
2323

2424

25-
defplot_colortable(colors,title,sort_colors=True,emptycols=0):
25+
defplot_colortable(colors,sort_colors=True,emptycols=0):
2626

2727
cell_width=212
2828
cell_height=22
2929
swatch_width=48
3030
margin=12
31-
topmargin=40
3231

3332
# Sort colors by hue, saturation, value and name.
3433
ifsort_colorsisTrue:
@@ -44,18 +43,17 @@ def plot_colortable(colors, title, sort_colors=True, emptycols=0):
4443
nrows=n//ncols+int(n%ncols>0)
4544

4645
width=cell_width*4+2*margin
47-
height=cell_height*nrows+margin+topmargin
46+
height=cell_height*nrows+2*margin
4847
dpi=72
4948

5049
fig,ax=plt.subplots(figsize=(width/dpi,height/dpi),dpi=dpi)
5150
fig.subplots_adjust(margin/width,margin/height,
52-
(width-margin)/width, (height-topmargin)/height)
51+
(width-margin)/width, (height-margin)/height)
5352
ax.set_xlim(0,cell_width*4)
5453
ax.set_ylim(cell_height* (nrows-0.5),-cell_height/2.)
5554
ax.yaxis.set_visible(False)
5655
ax.xaxis.set_visible(False)
5756
ax.set_axis_off()
58-
ax.set_title(title,fontsize=24,loc="left",pad=10)
5957

6058
fori,nameinenumerate(names):
6159
row=i%nrows
@@ -81,24 +79,22 @@ def plot_colortable(colors, title, sort_colors=True, emptycols=0):
8179
# Base colors
8280
# -----------
8381

84-
plot_colortable(mcolors.BASE_COLORS,"Base Colors",
85-
sort_colors=False,emptycols=1)
82+
plot_colortable(mcolors.BASE_COLORS,sort_colors=False,emptycols=1)
8683

8784
#############################################################################
8885
# ---------------
8986
# Tableau Palette
9087
# ---------------
9188

92-
plot_colortable(mcolors.TABLEAU_COLORS,"Tableau Palette",
93-
sort_colors=False,emptycols=2)
89+
plot_colortable(mcolors.TABLEAU_COLORS,sort_colors=False,emptycols=2)
9490

9591
#############################################################################
9692
# ----------
9793
# CSS Colors
9894
# ----------
9995

10096
# sphinx_gallery_thumbnail_number = 3
101-
plot_colortable(mcolors.CSS4_COLORS,"CSS Colors")
97+
plot_colortable(mcolors.CSS4_COLORS)
10298
plt.show()
10399

104100
#############################################################################

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp