Skip to content

Instantly share code, notes, and snippets.

View aaronsaunders's full-sized avatar

Aaron Marc Saunders aaronsaunders

View GitHub Profile
# https://github.com/matplotlib/matplotlib/issues/881
# Several of the ColorBrewer maps are "qualitative", meaning
# they are just a group of colors that can be used together
# for categories of data. So I remapped Accent to segments
# instead of continuous:
# Actually, these should be used with ListedColormap, and
# the number of colors should depend on the number of
# categories in the data, with colors removed from the
# list in a certain order?
def grouperchunker(seq, size):
return (seq[pos:pos + size] for pos in xrange(0, len(seq), size))
for group in grouper(animals, 3):
print group
from itertools import
def grouper(n, iterable, fillvalue=None):