1

I am trying to achieve a line plot similar to below in seaborn. Is there currently an option to colour a line plot as a function of another (continuous) variable in python seaborn, if so how do I achieve this? Below are x and y coordinates, and the line is coloured by time (created using ggplot2 in R).

Kraigolas
  • 5,121
  • 3
  • 12
  • 37
Furippu24
  • 11
  • 1
  • You could directly use matplotlib: https://matplotlib.org/stable/gallery/lines_bars_and_markers/multicolored_line.html?highlight=multicolor – JohanC May 10 '22 at 22:32
  • Hi Johan, thank for your response. I am still having a bit of difficulty. I have been able to change the colour of the line over time, however, since the method you sent involved splitting the original line into distinct segments and plotting those, the connections between each line segment does not look nice, is there a way to fix this, or is there another method to colour lines that does not result in this?: https://pasteboard.co/8D2ecnp0KANy.png – Furippu24 May 13 '22 at 05:00
  • I have solved the problem! see https://stackoverflow.com/questions/38079366/matplotlib-line3dcollection-multicolored-line-edges-are-jagged – Furippu24 May 13 '22 at 05:27

0 Answers0