Answers for "how to plot graph in matplotlib"

20

how to plot a graph using matplotlib

from matplotlib import pyplot as plt
plt.plot([0, 1, 2, 3, 4, 5], [0, 1, 4, 9, 16, 25])
plt.show()
Posted by: Guest on February-10-2020
1

how to plotting points on matplotlib

import matplotlib.pyplot as plt 
import numpy as np

data = np.random.rand(1024,2)
plt.scatter(data[:,0],data[:,1])
plt.show()
// Don't be
// fooled by this simplicity— plt.scatter() is a rich command.
Posted by: Guest on June-13-2020
2

matplotlib graph

matplotlib Graph
-------------------------------
import matplotlib.pyplot as plt  
x = [1, 2, 3, 4, 5] 
height = [10, 20, 30, 40, 50] 
tick_label = ['one', 'two', 'three', 'four', 'five'] 

plt.bar(x, height, tick_label = tick_label, 
		width = 0.5, color = ['red', 'green']) 

plt.xlabel('x  axis') 
plt.ylabel('y axis') 
plt.title('matplotlib Graph') 
plt.show()
Posted by: Guest on February-20-2021

Code answers related to "how to plot graph in matplotlib"

Python Answers by Framework

Browse Popular Code Answers by Language