Hi all, I am having trouble filling in symbols that represent seismic stations based on a different variable using PyGMT. I have seen other threads, but none of them seem to work.
I am trying to plot seismic stations on a map, and each station should be colored depending on the value of calculated Moment pertaining to the seismic station. I am using a Pandas dataframe , stations_df
, to store the information, and it looks like this:
Below is the code that I am using:
import pandas as pd
import pygmt
stations_df = pd.read_csv('gmtstations.dat')
overall_region = [-92,-68,25,47]
mi = stations_df.Moment.min()
ma = stations_df.Moment.max()
pygmt.makecpt(cmap='seis', continuous=True, series=[mi,ma,0.1e+24])
proj = 'M20c'
fig = pygmt.Figure() #Start the figure
fig.basemap(region=overall_region, projection=proj, frame=True)
fig.coast(region=overall_region, projection=proj, land='lightgrey', transparency =70, resolution='f')
fig.coast(projection=proj, resolution='f', borders = 'a', shorelines='0.2')
fig.plot(projection=proj, x=stations_df.LON, y=stations_df.LAT, fill=stations_df.Moment, cmap=True, style='t0.4', pen='black')
fig.show()
The figure that it creates is the following:
The code runs, but all the stations plot black instead of using the color palette that I assigned. I thought initially that the values of moment were too big, so I normalized all the moment values, but that still colored all the stations black. Is there something wrong with the way that I am calling the fill color/map or creating the color palette, or does anyone know where the issue could be? Thank you for your help!