Python 3 :
colormap = plt.cm.nipy_spectral
colors = [colormap(i) for i in np.linspace(0, 1,number_of_plots)]
ax.set_prop_cycle('color', colors)
:
import seaborn as sns
colors = sns.color_palette("hls", number_of_plots)
ax.set_prop_cycle('color', colors)