0

Is there any way to recover the default color cycle used for plotting lines, which is somehow defined by the matplotlib stylesheet.

Since the pie function does not use the default colors, I would like to force it to use them.

1 Answer 1

3

You can get the color cycle from the rc-params.

>>> from matplotlib import pyplot as plt
>>> color_cycle = plt.rcParams['axes.color_cycle']
>>> color_cycle
[u'b', u'g', u'r', u'c', u'm', u'y', u'k']

This can then be used as the colors argument to plt.pie.

Sign up to request clarification or add additional context in comments.

4 Comments

Unfortunately this doesn't work easily with 1.5 as the rc params there contains a cycler instance and not the raw array.
Maybe then you can cycle through as many colours as you need for your pie chart.
The problem is that the cycle includes a property name. Some it seems I have to wrap some code around it to be usable again :/
I'll accept this anyway now since there doesn't seem to be any other way to achieve this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.