Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

matplotlib: use colormaps for line plot colors

import numpy as np
import matplotlib.pylab as plt
plt.rcParams["figure.figsize"] = [7, 7]
plt.rcParams["figure.autolayout"] = True
x = np.array([0,1])
y = np.array([1,1])
n = 50
colors = plt.cm.hsv(np.linspace(0, 1, n))
for i in range(n):
    plt.plot(x,y * i, color=colors[i])
plt.show()
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #colormaps #line #plot #colors
ADD COMMENT
Topic
Name
7+5 =