Question about plot editing

Hello,

Here is the script :

import pygmt
#pygmt.show_versions() ;
import pandas as pd
#pandas.version ;
from pygmt.src import which

def Massin_M4_clean():

fname = which("Massin_M4_clean.dat")
data = pd.read_csv(fname, header=1, sep=r"\s+")
data.columns = [
    "year",
    "latitude",
    "longitude",
    "depth_km",
    "magnitude",
]
return data

data = pd.DataFrame(Massin_M4_clean())

region = pygmt.info(
data=data[[“longitude”, “latitude”, “depth_km”]],
per_column=True,
)

R = [-64, -58, 11, 19]

Perspective = [135, 25]

fig = pygmt.Figure()

pygmt.makecpt(cmap=“rainbow”,A = 10, series=[data.depth_km.min(), data.depth_km.max()])

fig.plot3d(

x=data.longitude,
y=data.latitude,
z=-(data.depth_km),

size=0.02 * (2 ** data.magnitude),

projection="M8i",

style="u",
pen="black",

color=data.depth_km,

cmap=True,

region=[
    data.longitude.min(),
data.longitude.max(),
data.latitude.min(),
data.latitude.max(),
-(data.depth_km.max()),
data.depth_km.min(),
],

frame=[
    
    'SEnwZ1+b+t"French Antilles seismicity"', 
    
    'xafg+l"latitude (cm)"',
    'yafg+l"longitude (cm)"',
    'zafg+l"depth_km"',
],
label=['z+w1p'], 

perspective= Perspective,

zscale=0.1,

)

fig.coast(shorelines=“1p,black”, region=region, projection=“M8i”, land=“#ffe398”,perspective=Perspective,yshift=24.3)

fig.colorbar(frame=‘af+l"Depth (km)"’,xshift=3.1,yshift= -25.3)

fig.show()

fig.savefig(“central-america-shorelines.png”)

And the resulting figure:

1 - I would like to know how to enlarge the font of the axes
2 - How do I add scaling to my X and Y axes?
3- Is it possible to replace the cubes by spheres? I have searched the GMT instructions “-S[symbol][size]”, but the only 3D figure is a cube, the rest is 2D…

thank you in advance for the help! :grin:

Hi @Remy, thanks for trying out PyGMT! To answer your questions:

This can be done using pygmt.config. It is a bit of an advanced feature, but try something like:

with pygmt.config(FONT_ANNOT_PRIMARY="20p"):
    fig.plot3d(...)

Full list of FONT parameters you can tweak are at gmt.conf — GMT 6.3.0 documentation.

Could you define what you mean by scaling? If you want to add extra annotations, try something like frame=["xa1fg", "ya2fg"] which would set annotations every 1 degree longitude and 2 degrees latitude (instead of 2 and 5 degrees currently). If you mean scaling the coordinates, maybe check out Scaling map annotations from metres to kilometes (though that is for Cartesian coordinates).

Unfortunately no, only cubes are currently supported for plot3d if you want 3-D :sweat_smile:

Hi @weiji14,

Thank you so much for these precisions, it will help me !

Could you define what you mean by scaling?

It was for add extra annotations :wink: