i have three stations named as A, B, C
. I want to plot them on a map using matplotlib basemap.
station A: latitude=17.8 longitude=74.48
station B: latitude=-25.02 longitude=25.60
station C: latitude=44.58 longitude=-123.30
As i am new to python and that to matplotlib, i am confused how should i plot it.
i tried the code:
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
plt.figure(figsize=(8, 8))
m = Basemap(projection='ortho', resolution=None, lat_0=50, lon_0=-100)
m.bluemarble(scale=0.5);
But it doesnot plot any of my stations.so i hope experts may help me.Thanks in advance.
Here's an example based on your data with which you might play around:
import pygmt
import pandas as pd
# create df with station information
data = {'lon':[74.48, 25.60, -123.30],
'lat':[17.8, -25.02, 44.58],
'station':['A', 'B', 'C']}
df = pd.DataFrame(data)
fig = pygmt.Figure()
pygmt.config(MAP_GRID_PEN = '0.25p,gray')
fig.grdimage("@earth_day_10m", region="g", projection="G130/50/12c", frame="g")
fig.plot(x = df.lon, y = df.lat, style = "t1c", color = "red3", pen = "1p,white")
fig.show()
The tutorials in the User Guide and the gallery examples are a good starting point when working with PyGMT the first time!