Ah right, ellipses, should have read more closely! In this case, you might want to try the new pygmt.Figure.velo function. It’s not available in the stable PyGMT v0.3.1 release, so you’ll need to install the PyGMT development version to use it:
pip install --pre --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple pygmt
after that, you should be able to use fig.velo
. The specification (spec) is a bit hardcoded, so you might need to reorder your pandas.DataFrame columns to be in the right order ( 1,2: longitude, latitude 3,4: eastward, northward velocity 5,6: semi-major, semi-minor axes). I had to make up some data for the Eastward/Northward columns to get the example below to work.
df380 = pd.DataFrame(
data={
"Longitude": [143.890395, 143.631681, 144.163615, 144.432449, 144.697050],
"Latitude": [-39.836134, -38.845903, -39.269567, -38.702371, -38.134570],
"Eastward": [0.5, 0.5, 0.5, 0.5, 0.5], # change this made up data
"Northward": [0.75, 0.75, 0.75, 0.75, 0.75], # change this made up data
"Major": [0.991056, 0.994992, 0.986036, 0.982666, 1.017184],
"Minor": [0.915180, 0.957652, 0.921038, 0.909278, 0.806435],
"azimuth": [86.690006, -88.008732, 89.187011, -78.331177, -57.902771],
}
)
fig = pygmt.Figure()
fig.velo(
data=df380,
spec="r0.5/0.95",
pen="0.6p,red",
uncertaintycolor="lightblue1",
frame=True,
)
fig.savefig(fname="ellipses.png")
fig.show()
which produces:
Hopefully the code above will be enough to get you started. Let us know if you need any clarification, it would be great to get feedback on the velo
function actually before we release it officially in PyGMT v0.4.0 (sometime in June 2021 perhaps).
References: