Coverage for /home/martinb/.local/share/virtualenvs/camcops/lib/python3.6/site-packages/statsmodels/graphics/plottools.py : 33%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1import numpy as np
3def rainbow(n):
4 """
5 Returns a list of colors sampled at equal intervals over the spectrum.
7 Parameters
8 ----------
9 n : int
10 The number of colors to return
12 Returns
13 -------
14 R : (n,3) array
15 An of rows of RGB color values
17 Notes
18 -----
19 Converts from HSV coordinates (0, 1, 1) to (1, 1, 1) to RGB. Based on
20 the Sage function of the same name.
21 """
22 from matplotlib import colors
23 R = np.ones((1,n,3))
24 R[0,:,0] = np.linspace(0, 1, n, endpoint=False)
25 #Note: could iterate and use colorsys.hsv_to_rgb
26 return colors.hsv_to_rgb(R).squeeze()