# Insert 2D plane into a 3D Plotly scatter plot in R

**URL:** <https://community.plotly.com/t/insert-2d-plane-into-a-3d-plotly-scatter-plot-in-r/30833>\
**Category:** Plotly R\
**Created:** [November 3, 2019, 12:41pm UTC](https://community.plotly.com/t/insert-2d-plane-into-a-3d-plotly-scatter-plot-in-r/30833 "2019-11-03T12:41:22Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![empet](https://avatars.discourse-cdn.com/v4/letter/e/977dab/32.png) [@empet](https://community.plotly.com/u/empet)\
**Post date:** [November 3, 2019, 6:44pm UTC](https://community.plotly.com/t/insert-2d-plane-into-a-3d-plotly-scatter-plot-in-r/30833/6 "2019-11-03T18:44:02Z")

</div>

@jdude49  
Below is the Python code for plotting such a plane. It seems that the 2d Kernel Density estimation example posted here [https://plot.ly/r/3d-surface-plots/](https://plot.ly/r/3d-surface-plots/) plots a surface defined by x, y, z. The colorscale is Viridis, by defalut in that example.

```auto
import numpy as np
import plotly.graph_objects as go
height=2
x= np.linspace(-1, 1, 75)
y= np.linspace(0, 2, 100)
z= height*np.ones((100,75))
mycolorscale = [[0, '#aa9ce2'],
                [1, '#aa9ce2']]

surf = go.Surface(x=x, y=y, z=z, colorscale=mycolorscale, showscale=False)
layout = go.Layout(width=600,
                  scene_camera_eye_z=0.75)
fig = go.Figure(data=[surf], layout=layout)
fig.show()

```

![z-plane](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/f/f7cc3f0ed813be9d1bdcf453b6a7b6764e4451d2.png)

---

_[View the full topic](https://community.plotly.com/t/insert-2d-plane-into-a-3d-plotly-scatter-plot-in-r/30833)._
