# Avoid saw edges on 3d surfaces

Hello

I am building a surface from a list of points using

``````def surface(grid,metodo): #metodo='linear', 'cubic' o 'nearest'

tx=grid[0]
ty=grid[1]
tz=grid[2]

X = np.linspace(min(tx), max(tx))
Y = np.linspace(min(ty), max(ty))
X, Y = np.meshgrid(X, Y)  # 2D grid for interpolation
Z = griddata((tx,ty),tz,(X,Y),
method=metodo)

return [tx,ty,tz,X,Y,Z]
``````

Then given a list of points L, I define sL=surface(L,โlinearโ) and the figure

``````fig=go.Figure()

colorscale='brwnyl',
opacity = 1,
name='surface',
legendgroup='surface',
showlegend=True,
showscale=False))

fig.update_layout(
scene = dict(
xaxis=dict(title='X',
tickfont = dict(size = 10,color = 'black'),
title_font_size=10,
titlefont_color='black',
backgroundcolor='white',
color='black',
gridcolor='gray'),
yaxis=dict(title='Y',
tickfont = dict(size = 10,color = 'black'),
title_font_size=10,
titlefont_color='black',
backgroundcolor='white',
color='black',
gridcolor='gray'),
zaxis=dict(nticks=4,
tickfont = dict(size = 10,color = 'black'),
title='Z',
title_font_size=10,
titlefont_color='black',
range=[100,600],
backgroundcolor='white',
color='black',
gridcolor='gray'),
aspectratio=dict(x=2, y=2, z=0.5)),
#aspectmode='data'),
scene_camera= camera
)

fig.show()
``````

and the result is

How can I avoid the serrated edge?

Thanks

@bullejos To get help, please provide data. Itโs unclear what type has the argument `grid` of the function `surface`.

Hi @empet ,

The grid data is just a list of points (in my case it is a list of points, with UTM_X, UTM_Y and elevation coordinates, which come from a list of points in a grid that are inside a polygon). The code linspace(min(tx), max(tx)) can be change by linspace(min(tx), max(tx), n ) with n a positive integer and if n is big enough steps at the border of the surface are smaller. This may be the only solution, I have seen other surfaces that appear to have a line as a border but when you get close enough the line is jagged.

Thais @empet