1from matplotlib import pyplot as plt
2plt.plot([0, 1, 2, 3, 4, 5], [0, 1, 4, 9, 16, 25])
3plt.show()
1names = ['group_a', 'group_b', 'group_c']
2values = [1, 10, 100]
3
4plt.figure(figsize=(9, 3))
5
6plt.subplot(131)
7plt.bar(names, values)
8plt.subplot(132)
9plt.scatter(names, values)
10plt.subplot(133)
11plt.plot(names, values)
12plt.suptitle('Categorical Plotting')
13plt.show()
14
1# importing matplotlib module
2from matplotlib import pyplot as plt
3
4# x-axis values
5x = [5, 2, 9, 4, 7]
6
7# Y-axis values
8y = [10, 5, 8, 4, 2]
9
10# Function to plot scatter
11plt.scatter(x, y)
12
13# function to show the plot
14plt.show()
1# importing matplotlib module
2 from matplotlib import pyplot as plt
3
4# Plotting to our canvas
5 plt.plot([1,2,3],[4,5,1])
6
7# Showing what we plotted
8 plt.show()