Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python plot two lines on same graph

import matplotlib.pylot as plt
x_coordinates = [1, 2, 3]

y1_coordinates = [1, 2, 3]
y2_coordinates = [3, 4, 5]

fig = plt.figure(1)
plt.plot(x_coordinates, y1_coordinates) # plot first line
plt.plot(x_coordinates, y2_coordinates) # plot second line
plt.show()
Comment

python plot multiple lines in same figure

# Short answer:
Call plt.plot() as many times as needed to add additional lines to plot.

# Example usage:
import matplotlib.pylot as plt
x_coordinates = [1, 2, 3]

y1_coordinates = [1, 2, 3]
y2_coordinates = [3, 4, 5]

plt.plot(x_coordinates, y1_coordinates) # plot first line
plt.plot(x_coordinates, y2_coordinates) # plot second line
Comment

PREVIOUS NEXT
Code Example
Python :: boto3 delete bucket object 
Python :: python env 
Python :: append vs insert python 
Python :: python classes 
Python :: split data train python 
Python :: read from text file and append in list 
Python :: kafka get last offset of topic python 
Python :: pytest multi thread 
Python :: Add Border to input Pysimplegui 
Python :: os.chdir python 
Python :: basic tkinter window 
Python :: df to csv 
Python :: handle errors in flask 
Python :: drop column from dataframe 
Python :: how to url encode using python django 
Python :: python spotify player 
Python :: python remove empty lines from file 
Python :: iterate through characters in a string python 
Python :: operator precedence in python 
Python :: obtener el mayor valor de un diccionario python 
Python :: python define random variables name 
Python :: ejercicios con funciones en python 
Python :: aes in python 
Python :: openpyxl load file 
Python :: python return min length of list 
Python :: split data train, test by id python 
Python :: multiline comment python 
Python :: python add field to dictionary 
Python :: pandas rename column values dictionary 
Python :: create a blank image opencv 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =