# Question about plot 3d in Pygmt

Hello guys:

How to get the base map to be in the right position with plot3d?

The script bellow:

import pygmt
import pandas as pd

#Region
minlon, maxlon = 119.009904, 129.543823
minlat, maxlat = -1.916803, 6.398782
mindepth, maxdepth = -1000,0
region = [minlon,maxlon,minlat,maxlat,mindepth,maxdepth]

#pygmt Figure
fig = pygmt.Figure()
#Set the azimuth and elevation angle
perspective=[165,15]
#make color ramp for depth
pygmt.makecpt(cmap=“jet”, series=[data.depth.min(),data.depth.max()])
#plot 3d
fig.plot3d (region = region,
x = data.longitude,
y = data.latitude,
z = data.depth * -1,
size = 0.002 * (2**data.magnitude),
projection =‘M8i’,
style=“u”,
pen=“black”,
color=data.depth,
cmap = True,
frame=[‘SEnwZ1+b+t""’,‘xafg+l"latitude"’,‘yafg+l"longitude"’,‘zafg+l"depth (km)"’,],
label=[‘z+w1p’],
#frame =[“WsNeZ3”,‘xafg+l"longitude"’,‘yafg+l"latitude"’,‘zafg+l"Depth (km)"’],
perspective=perspective,
zscale=“0.01”)

#Plot basemap
fig.coast(region=[minlon,maxlon,minlat,maxlat],
projection=‘M8i’,
shorelines=‘0.25p,black’,
land=‘grey’,
#water=‘lightblue’,
perspective=perspective,
yshift=24.3)

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

1 Like

What is the “the right position”? Do you mean just in top of the 3d block?

If so, maybe you could try changing `yshift=24.3`.

yes I do
I mean the basemap just in top the 3d block