For now, the pygmt integration is still pretty basic. Please create GitHub issues and let us know how we can enhance the pygmt integration. We are grateful for your constructive feedbacks. Thank you!
In [1]:
from gplately.auxiliary import get_gplot, get_pygmt_basemap_figure
from gplately.mapping.pygmt_plot import PygmtPlotEngine
# tell PlotTopologies object to use the PygmtPlotEngine
gplot = get_gplot(
model="merdith2021",
model_repo_dir="plate-model-repo",
time=55,
plot_engine=PygmtPlotEngine(),
)
# you need to know how to specify projection and region in GMT way
fig = get_pygmt_basemap_figure(projection="N180/10c", region="d")
# now you can plot some features with the PlotTopologies object
gplot.plot_topological_plate_boundaries(
fig,
edgecolor="black",
linewidth=0.25,
central_meridian=180,
gmtlabel="plate boundaries",
)
gplot.plot_coastlines(
fig, edgecolor="none", facecolor="gray", linewidth=0.1, central_meridian=180
)
gplot.plot_ridges(fig, pen="0.5p,red", gmtlabel="ridges")
gplot.plot_transforms(fig, pen="0.5p,red", gmtlabel="transforms")
gplot.plot_subduction_teeth(fig, color="blue", gmtlabel="subduction zones")
# use pygmt directly to plot title and legend
fig.text(
text="55Ma (Merdith2021)",
position="TC",
no_clip=True,
font="12p,Helvetica,black",
offset="j0/-0.5c",
)
fig.legend(position="jBL+o-2.7/0", box="+gwhite+p0.5p")
fig.show(width=1200)
The code cell below is not important. Just let you know that plotting grid and velocities with pygmt has not been implemented yet.
In [2]:
try:
# plotting grid has not been implemented in PygmtPlotEngine yet.
gplot.plot_grid(fig, None)
except NotImplementedError as e:
print(e)
try:
# plotting velocities has not been implemented in PygmtPlotEngine yet.
gplot.plot_plate_motion_vectors(fig)
except NotImplementedError as e:
print(e)
Plotting grid has not been implemented for <class 'gplately.mapping.pygmt_plot.PygmtPlotEngine'> yet. Plotting velocities has not been implemented for <class 'gplately.mapping.pygmt_plot.PygmtPlotEngine'> yet.
In [ ]: