Following the answers of both topics [Matplotlib: Plotting numerous disconnected line segments with different colors](https://stackoverflow.com/questions/21352580/matplotlib-plotting-numerous-disconnected-line-segments-with-different-colors) and [matplotlib: how to change data points color based on some variable](https://stackoverflow.com/questions/7881994/matplotlib-how-to-change-data-points-color-based-on-some-variable), I am trying to plot a set of segments given by a list, for instance:

```
data = [(-118, -118), (34.07, 34.16),
        (-117.99, -118.15), (34.07, 34.16),
        (-118, -117.98), (34.16, 34.07)]

```

and I would like to plot each segments with a color based on a second list for instance:

```
color_param = [9, 2, 21]

```

with a colormap. So far I am using this line to display the segments:

```
plt.plot(*data)

```

I was expecting that something like

```
plt.plot(*data, c=color_param, cmap='hot')

```

would work but it doesn't. Can anybody help me solving this problem? I would rather work with matplotlib if possible.

Thank you in advance!