擅长:python、mysql、java
<p>@Evert的评论起到了帮助作用</p>
<blockquote>
<p>You define your own set of (cyclic) colours.
Simple example at <a href="http://matplotlib.org/examples/color/color_cycle_demo.html" rel="nofollow noreferrer">matplotlib.org/examples/color/color_cycle_demo.html</a> , and available colours at <a href="http://matplotlib.org/gallery.html#color" rel="nofollow noreferrer">matplotlib.org/gallery.html#color</a> . – Evert </p>
</blockquote>
<p>修改了上面的pydef函数:</p>
<pre><code>import matplotlib.pyplot as plt
from cycler import cycler
palette = ['#ff0000', '#663600', '#a3cc00', '#80ffc3', '#0088ff', '#d9bfff', '#a6296c', '#8c4646', '#ff8800', '#5e664d', '#269991', '#1d3f73', '#7e468c', '#d96236', '#7f2200']
# 1. Setting prop cycle on default rc parameter
plt.rc( 'lines', linewidth = 4 )
plt.rc( 'axes', prop_cycle = ( cycler( 'color', palette ) ) )
</code></pre>