0

I am trying to use matplotlib to plot two lists in one plot using extend, but each list with different colors

list1= [0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1. , 1.1, 1.2,
           1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2. , 2.1, 2.2, 2.3, 2.4]
list2=[2.5, 2.6, 2.7, 2.8, 2.9, 3. , 3.1, 3.2, 3.3, 3.4]
list1.extend(list2)
plt.plot(list1)
4
  • plt.plot(list1, '-r', list2, '-g') Commented Jul 31, 2022 at 1:20
  • @TrentonMcKinney I am trying to plot the combined (list_com) with highlighting the values of list2 with different color Commented Jul 31, 2022 at 1:26
  • See the other duplicates that have been added Commented Jul 31, 2022 at 1:29
  • @TrentonMcKinney very much appreciated that! I have tried the three duplicates but doesn't work due to having the lists of a different dimension! the first duplicate gave errors Commented Jul 31, 2022 at 1:42

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.