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

Skip to content

Commit 23f17dd

Browse files
committed
Merge pull request #4261 from mscross/examples_color_named
MNT : update example with preferred plt.subplots
2 parents 166e9cc + 11fffe2 commit 23f17dd

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

examples/color/named_colors.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@
4141
ncols = 4
4242
nrows = int(np.ceil(1. * n / ncols))
4343

44-
fig = plt.figure()
45-
ax = fig.add_subplot(111)
44+
fig, ax = plt.subplots()
4645

4746
X, Y = fig.get_dpi() * fig.get_size_inches()
4847

@@ -64,8 +63,8 @@
6463
horizontalalignment='left',
6564
verticalalignment='center')
6665

67-
# Add extra black line a little bit thicker to make
68-
# clear colors more visible.
66+
# Add extra black line a little bit thicker to make
67+
# clear colors more visible.
6968
ax.hlines(y, xi_line, xf_line, color='black', linewidth=(h * 0.7))
7069
ax.hlines(y + h * 0.1, xi_line, xf_line, color=color, linewidth=(h * 0.6))
7170

0 commit comments

Comments
 (0)