Zoom level base on the plotted point

Is there a way wherein you can adjust the zoom level of the map base on the plotted point? I mean instead of putting the latitude and longitude manually in the region, we will use the coordinates of the plotted point as reference for it. Is this possible?

Mm I am not sure if understand correctly. I imagine you have a file with long and lat of some points, I you want to make a plot where this points can be see fine. Is it correct?

I think what you imagined is correct except I only had a 1 point. I think the best way to describe or imagine it is when you entered a long and lat in a google map

Ok.

Which projection do you want to use? Do you have a script?

region=[116.00,129.00,2.00,22.00]
Lat = [14.06038]
Lon = [121.48803]

grid = pygmt.datasets.load_earth_relief(resolution="30s",region=region)
fig = pygmt.Figure()
fig.grdimage(grid=grid, projection= 'M25',frame='a50f50',cmap = 'geo')

fig.plot(
    data="AF.gmt",
    pen=".1p,red",
)

fig.plot(
    data="trench.gmt",
    Sf = '+.2i/.1i+l+t',
    color="blue",
    pen=".1p,blue",
)

fig.plot(
	x =Lon,
	y =Lat,
	style = 'c0.1i',
	color = 'red',
	pen= ".1p,black",
)

fig.savefig("seismotectonic_settings.png")

Right now I have this script wherein I defined the region

So, basically do you want to set the long and lat of the center of your map and a zoom level? For azimutal projection could be easier.

Do you want to use a mercator projection?

Maybe it could be done trough mapproject.

In google maps there are 20 zoom level. This is the scale for each zoom (I didn’t check it).

20 : 1128.497220
19 : 2256.994440
18 : 4513.988880
17 : 9027.977761
16 : 18055.955520
15 : 36111.911040
14 : 72223.822090
13 : 144447.644200
12 : 288895.288400
11 : 577790.576700
10 : 1155581.153000
9  : 2311162.307000
8  : 4622324.614000
7  : 9244649.227000
6  : 18489298.450000
5  : 36978596.910000
4  : 73957193.820000
3  : 147914387.600000
2  : 295828775.300000
1  : 591657550.500000

yes, I want the given point to be center of my map then adjust the zoom level.

yes I want to use mercator projection.

Maybe you can try another method to define the region. I think you can specified the longitude and latitude in the projection like this

projection= 'Mlong/lat/25'

and then in the region you could indicate a distance (in km) from the long and lat:

region="50/50/20/20+uk"

-R xmin/xmax/ymin/ymax +u unit. Append +u unit to the option 1 to specify a region in projected units (e.g., UTM meters) where xmin/xmax/ymin/ymax are Cartesian projected coordinates compatible with the chosen projection and unit is an allowable distance unit. The coordinates are relative to the standard longitude and latitude indicated in the projection (-J).

I see so this is possible. I got a “grdcut [ERROR]”.

Thank you for this idea, I came up within an two solution due to this. The first solution is I create multiple region( I divided my main basemap into 5 parts), then automatically choose a region based on the given point(lat and lon).
The second solution I came up is I added(maximum) and subtracted(minimum) some numbers/degrees on the lat and lon of the point.

region = [lon -4, lon +4, lat-4, lat +4]