3D scatter plot with 2D histogram at sides
<p>I would like to make a 3D scatterplot with with the 2D projections at each side. Something like the following:</p>

<p><a href="https://i.stack.imgur.com/Eb2FP.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Eb2FP.png" alt="3D scatter"></a></p>

<p>The scatterplot has been created with:</p>

<pre><code>fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.scatter(x, y, z, c='r', marker='.')
</code></pre>

<p>And the projections with:</p>

<pre><code> h = np.np.histogram2d(x, y)
 plt.imshow(h, cmap='cubehelix_r', interpolation='none')
</code></pre>

<p>And they have been brought together with inkscape. How would I do this completely with <code>matplotlib</code>?</p>