Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
colors unsorted
  • Loading branch information
fariza committed Feb 6, 2014
commit 3a596d35e5688ce70e6279d81f6aa8d0ef8f3c13
35 changes: 35 additions & 0 deletions examples/color/named_colors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#issue https://github.com/matplotlib/matplotlib/issues/2164

import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import cnames
from itertools import chain

print len(cnames.keys())
n = len(cnames)
ncols = n / 15
nrows = n / ncols
names = cnames.keys()
colors = cnames.values()

fig, axes_ = plt.subplots(nrows=nrows, ncols=ncols)
axes = list(chain(*axes_))

for i in range(n):
title = axes[i].set_title(names[i])
title.set_size('xx-small')
axes[i].set_axis_bgcolor(colors[i])
axes[i].spines['right'].set_visible(False)
axes[i].spines['top'].set_visible(False)
axes[i].spines['bottom'].set_visible(False)
axes[i].spines['left'].set_visible(False)
axes[i].set_xticks([])
axes[i].set_yticks([])

# axes[i].set_label(names[i])

# for axes in list(chain(*axes_)):
# axes.set_axis_off()

# print nrows, ncols, fig, axes
plt.show()