close

How to plot two list in the same graph, but with different colors?

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How to plot two list in the same graph, but with different colors in Python. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

Table of Contents

How to plot two list in the same graph, but with different colors?

  1. How to plot two list in the same graph, but with different colors?

    I don't know what is your X axis but obviously you should create another array/list to be your X value.

  2. plot two list in the same graph, but with different colors

    I don't know what is your X axis but obviously you should create another array/list to be your X value.

Method 1

You should use plt.plot twice to plot two lines.

I don’t know what is your X axis but obviously you should create another array/list to be your X value.

Then use plt.plot(x_value,forecast, c='color-you-want') and plt.plot(x_value,train_z, c='another-color-you-want').

. Please refer to the pyplot documentation for more details.

Method 2

import matplotlib.pyplot as plt
plt.plot([1,2,3,4,12,15],'g*', [1,4,9,16], 'ro')
plt.show()

Summery

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

Also, Read