How to draw line on Contour map

Hi, I am a beginner at both R and plotly. I want to generate something like below image, but i can’t find how to append line on contour map. I did try “add_trace(x=x, y=y, type=‘scatter’, mode=“line”)”, but it didn’t work and give me error message “‘scatter’ objects don’t have these attributes: ‘z’, ‘contours’” . I would really appreciate it if you give me some advice or reference. thank you.