Default color cycle

A color cycle is a list of colors used to control the color of a series of elements automatically, such as each data series in multiline plots. In Matplotlib 2.0, the default color cycle has expanded from 7 to 10 colors using the category10 palette in Data-Driven Documents (D3) https://github.com/d3 and Vega, a declarative language for visualization grammar. These colors are designed to show good contrast between distinct categories. Each color is named 'C0' to 'C9', and can be called in manually by specifying a color in the preset color cycle. Here is a toy example of a multiline plot with each color in the default cycle:

import matplotlib.pyplot as pltfor i in range(10): plt.plot([i]*5,c='C'+str(i),label='C'+str(i)) ...

Get Matplotlib for Python Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.