Plot points from a .txt file on a pygmt map

Hello. I have a topographic map of North Irleand and I would like to plot seismic stations as points on it. I have a “.txt” file with the name and coordinates (longitude and latitude) of the seismic stations I want to plot and they are divided by sep.
stat = pd.read_csv(“stat.txt”, sep=’\s+’)
stat.columns =[‘net’, ‘stat’, ‘Longitude’,‘Latitude’]

stat.Longitude= stat.iloc [:,2]
stat.Latitude= stat.iloc [:,3]


fig = pygmt.Figure()
fig.basemap(region=region, projection=“M15c”, frame=True)

pygmt.makecpt(cmap=“palette-topo.cpt”, series=[-1000, 1000, 3])

dgrid = pygmt.grdgradient(grid=“”, azimuth=90, outgrid=‘donegal2.grd’)

fig.grdimage(grid=‘’, shading=‘donegal2.grd’, region=region, dpi=300, projection=‘M12c’, frame=False, cmap=True)

#fig.coast(region=region, land=“black”, water=“skyblue”)
#fig.plot(x=stat.Longitude, y=stat.Latitude, size=2 , style=‘cc’, color=“white”, pen=“black”)

this is the cell that I run for the plot but it gives me this error:
TypeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_24428/ in
14 #fig.coast(region=region, land=“black”, water=“skyblue”)
—> 15 fig.plot(x=stat.Longitude, y=stat.Latitude, size=2 , style=‘cc’, color=“white”, pen=“black”)

TypeError: len() of unsized object

How can I solve it? Thanks :slight_smile:

It is interesting but size parameter must be an array. Thus, your line should be as below:

15 fig.plot(x=stat.Longitude, y=stat.Latitude, size=[2] , style=‘cc’, color=“white”, pen=“black”)

Please notice, I’ve put size value into array, nothing else.