1from matplotlib import pyplot as plt
2plt.plot([0, 1, 2, 3, 4, 5], [0, 1, 4, 9, 16, 25])
3plt.show()
1matplotlib Graph
2-------------------------------
3import matplotlib.pyplot as plt
4x = [1, 2, 3, 4, 5]
5height = [10, 20, 30, 40, 50]
6tick_label = ['one', 'two', 'three', 'four', 'five']
7
8plt.bar(x, height, tick_label = tick_label,
9 width = 0.5, color = ['red', 'green'])
10
11plt.xlabel('x axis')
12plt.ylabel('y axis')
13plt.title('matplotlib Graph')
14plt.show()
1import numpy as np
2import pandas as pd
3import matplotlib.pyplot as plt
4
5df = pd.read_csv("filesc/file1.csv")
6df.head()
7
8BBox = ((df.x.min(), df.x.max(), df.y.min(), df.y.max()))
9
10ruh_m = plt.imread('map.png')
11
12print(BBox)
13
14fig, ax = plt.subplots(figsize = (8,7))
15ax.scatter(df.x, df.y, zorder=1, alpha= 0.2, c='b', s=10)
16ax.set_title('Plotting Spatial Data on Map')
17ax.set_xlim(BBox[0],BBox[1])
18ax.set_ylim(BBox[2],BBox[3])
19ax.imshow(ruh_m, zorder=0, extent = BBox, aspect= 'equal')
20plt.show()
21
22