<p>The value 's' in the original graph is the variance, which is the square of the Gaussian sigma (i.e. the scale parameter of the normal distribution). So <code>norm.pdf(xx,0,np.sqrt(yy))</code> should be correct.</p>

<p>Note that the shape of the peak you see is very much dependent on the y value where the graph starts. Your starting point of 0.1 may be a little smaller than in the original graph, which looks like it starts at about 1/6 ~= 0.167, so you may see a narrower and taller peak for that reason. Also, the original graph doesn't quite have enough horizontal resolution to resolve the shape of the peak entirely, as you can see from how far apart the grid lines are spaced vertically on the sides of the peak.</p>

CC BY-SA 4.0
2019-10-16T01:54:04.657Z
Thank you! You are so helpful! Does "horizontal resolution" mean the interval granularity between -5 and 5 along **x-axis**?
JJJohn
CC BY-SA 4.0
2019-10-16T02:24:22.857Z
Yes, mainly I was thinking of the x axis.
Nathan Reed
CC BY-SA 4.0
2019-10-15T21:01:23.373Z
2019-10-15T21:01:23.373Z
Nathan Reed
<p>this <a href="https://math.stackexchange.com/q/3391749/673047">figure</a> (fig_1) is an univariate normal distribution in 3D, the corresponding equation is in the top left hand corner</p>

<p><a href="https://i.sstatic.net/11wRJ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/11wRJ.png" alt="enter image description here"></a></p>

<p>it seems that x varies from -5 to 5; sigma varies from 0 to 4.</p>

<p>This Python code is trying to reproduce this figure</p>

<pre><code>ax = plt.figure().gca(projection='3d')
xx, yy = np.meshgrid(np.arange(-5,5,.1), np.arange(0.1,4,.1))
zz = norm.pdf(xx,0,yy)
ax.plot_surface(xx, yy, zz, alpha=.5)
</code></pre>

<p>and I got this figure</p>

<p><a href="https://i.sstatic.net/uIylt.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/uIylt.png" alt="enter image description here"></a></p>

<p>and this guy</p>

<pre><code>zz = norm.pdf(xx,0,np.sqrt(yy))
</code></pre>

<p>gives this figure</p>

<p><a href="https://i.sstatic.net/rXfBq.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/rXfBq.png" alt="enter image description here"></a></p>

<p>which is better although the kurtosis looks a little higher than fig_1.</p>

<p>any clue</p>

<3d>
Why does my code generate a figure whose kurtosis looks a little higher than the one I am trying to reproduce?
JJJohn
# Why does my code generate a figure whose kurtosis looks a little higher than the one I am trying to reproduce?

(Asked by: username_0 on 2019-10-15)

this [figure](https://math.stackexchange.com/q/3391749/673047) (fig\_1) is an univariate normal distribution in 3D, the corresponding equation is in the top left hand corner

[![enter image description here](https://i.sstatic.net/11wRJ.png)](https://i.sstatic.net/11wRJ.png)

it seems that x varies from -5 to 5; sigma varies from 0 to 4.

This Python code is trying to reproduce this figure

```
ax = plt.figure().gca(projection='3d')
xx, yy = np.meshgrid(np.arange(-5,5,.1), np.arange(0.1,4,.1))
zz = norm.pdf(xx,0,yy)
ax.plot_surface(xx, yy, zz, alpha=.5)

```

and I got this figure

[![enter image description here](https://i.sstatic.net/uIylt.png)](https://i.sstatic.net/uIylt.png)

and this guy

```
zz = norm.pdf(xx,0,np.sqrt(yy))

```

gives this figure

[![enter image description here](https://i.sstatic.net/rXfBq.png)](https://i.sstatic.net/rXfBq.png)

which is better although the kurtosis looks a little higher than fig\_1.

any clue

**Tags:** 3d


---

## 1 answers

### Answer by username_1 on 2019-10-15. Score: 2 | Accepted answer

The value 's' in the original graph is the variance, which is the square of the Gaussian sigma (i.e. the scale parameter of the normal distribution). So `norm.pdf(xx,0,np.sqrt(yy))` should be correct.

Note that the shape of the peak you see is very much dependent on the y value where the graph starts. Your starting point of 0.1 may be a little smaller than in the original graph, which looks like it starts at about 1/6 ~= 0.167, so you may see a narrower and taller peak for that reason. Also, the original graph doesn't quite have enough horizontal resolution to resolve the shape of the peak entirely, as you can see from how far apart the grid lines are spaced vertically on the sides of the peak.

> **Comments:**
> **username_0**: Thank you! You are so helpful! Does "horizontal resolution" mean the interval granularity between -5 and 5 along **x-axis**?  
> **username_1**: Yes, mainly I was thinking of the x axis.  

---

