Change line thickness and colour according to continuous variable

Hi everyone,

Long time reader, first time poster.

I’m having trouble figuring out how to do the following; a line graph (or similair) in which the thickness (and colour if possible) changes according to a 3rd variable. So it would look something like this image

Can this be done? Any pointers would be greatly appreciated.

Many thanks,