|
26 | 26 | line0 = figure[0, 0].add_line(sine, thickness=10) |
27 | 27 |
|
28 | 28 | # set colormap along line datapoints, use an offset to place it above the previous line |
29 | | -line1 = figure[0, 0].add_line(sine, thickness=10, cmap="jet", offset=(0, 2, 0)) |
| 29 | +line1 = figure[0, 0].add_line(sine, thickness=10, cmap="jet", uniform_color=False, offset=(0, 2, 0)) |
30 | 30 |
|
31 | 31 | # set colormap by mapping data using a transform |
32 | 32 | # here we map the color using the y-values of the sine data |
33 | 33 | # i.e., the color is a function of sine(x) |
34 | | -line2 = figure[0, 0].add_line(sine, thickness=10, cmap="jet", cmap_transform=sine[:, 1], offset=(0, 4, 0)) |
| 34 | +line2 = figure[0, 0].add_line( |
| 35 | + sine, |
| 36 | + thickness=10, |
| 37 | + cmap="jet", |
| 38 | + cmap_transform=sine[:, 1], |
| 39 | + uniform_color=False, |
| 40 | + offset=(0, 4, 0), |
| 41 | +) |
35 | 42 |
|
36 | 43 | # make a line and change the cmap afterward, here we are using the cosine instead fot the transform |
37 | | -line3 = figure[0, 0].add_line(sine, thickness=10, cmap="jet", cmap_transform=cosine[:, 1], offset=(0, 6, 0)) |
| 44 | +line3 = figure[0, 0].add_line( |
| 45 | + sine, |
| 46 | + thickness=10, |
| 47 | + cmap="jet", |
| 48 | + cmap_transform=cosine[:, 1], |
| 49 | + uniform_color=False, |
| 50 | + offset=(0, 6, 0) |
| 51 | +) |
| 52 | + |
38 | 53 | # change the cmap |
39 | 54 | line3.cmap = "bwr" |
40 | 55 |
|
41 | 56 | # use quantitative colormaps with categorical cmap_transforms |
42 | 57 | labels = [0] * 25 + [1] * 5 + [2] * 50 + [3] * 20 |
43 | | -line4 = figure[0, 0].add_line(sine, thickness=10, cmap="tab10", cmap_transform=labels, offset=(0, 8, 0)) |
| 58 | +line4 = figure[0, 0].add_line( |
| 59 | + sine, |
| 60 | + thickness=10, |
| 61 | + cmap="tab10", |
| 62 | + cmap_transform=labels, |
| 63 | + uniform_color=False, |
| 64 | + offset=(0, 8, 0), |
| 65 | +) |
44 | 66 |
|
45 | 67 | # some text labels |
46 | 68 | for i in range(5): |
|
0 commit comments