Skip to content

Instantly share code, notes, and snippets.

@akashks1998
Last active January 31, 2021 17:16
Show Gist options
  • Save akashks1998/283410b3f014d5fc68b4766e32b35552 to your computer and use it in GitHub Desktop.
Save akashks1998/283410b3f014d5fc68b4766e32b35552 to your computer and use it in GitHub Desktop.
import matplotlib.pyplot as plt 
  
# x axis values 
x = [int(i) for i in input().split()]
# corresponding y axis values 
y = [float(i) for i in input().split()]
  
# plotting the points  
plt.plot(x, y) 
  
# naming the x axis 
plt.xlabel('Input') 
# naming the y axis 
plt.ylabel('Time') 
  
# giving a title to my graph 
plt.title('Time vs Input graph') 
# function to save the plot 
plt.savefig('graph.png')

Input Format

First line will contain array of n, second line will contain time

Example input

1 2 3
10 20 40

Generated Graph

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment