Args: n: number of distinct colors name: name of matplotlib colormap Returns: A function that maps each index in 0, 1, ..., n-1 to a distinct RGB color; the keyword argument name must be a standard mpl colormap name.
(n: int, name: str = "hsv")
| 36 | |
| 37 | |
| 38 | def get_cmap(n: int, name: str = "hsv") -> Colormap: |
| 39 | """ |
| 40 | Args: |
| 41 | n: number of distinct colors |
| 42 | name: name of matplotlib colormap |
| 43 | |
| 44 | Returns: |
| 45 | A function that maps each index in 0, 1, ..., n-1 to a distinct |
| 46 | RGB color; the keyword argument name must be a standard mpl colormap name. |
| 47 | """ |
| 48 | return plt.cm.get_cmap(name, n) |
| 49 | |
| 50 | |
| 51 | def make_labeled_image( |
no outgoing calls
no test coverage detected