# [Matplotlib-users] 3D scatter plot with 'unlimited' Z axis

Will Furnell mail at willfurnell.com
Tue Oct 2 06:43:49 EDT 2018

```Hello Ben,

Thank you very much, this works perfectly for me!

Best,

Will.

On 01/10/2018 21:10, Benjamin Root wrote:
> ```
> x = np.arange(256)
> y = np.arange(256)
> xx, yy = np.meshgrid(x, y)
> ```
> Then your `xx` and `yy` will be 2D, just like your `ll` variable. Then,
> you pass the flattened versions of those three variables (i.e.,
> `xx.flatten()` or `xx.flat`) to the 3d scatter call.
>
> I hope that helps!
> Ben Root
>
>
> On Mon, Oct 1, 2018 at 3:47 PM Will Furnell <mail at willfurnell.com
> <mailto:mail at willfurnell.com>> wrote:
>
>     Hey everyone,
>
>     I'm looking into a 3D scatter plot - basically converting a NumPy array
>     to a 3D plot, where X and Y correspond to the X and Y co-ordinates on
>     the graph and the Z values corresponds to a particular height on the
>     graph.
>
>     This is how I'm generating the lists:
>
>
>     x = list(range(0, 256))
>     y = list(range(0, 256))
>     z = []
>
>     for i in range(0, 255):
>         for j in range(0, 255):
>             z.append(ll[i][j])
>
>     where ll is my 2D array...
>
>     I've seen the scatter function with 3d projection, but this requires the
>     Z array length to be the same length as the X and Y lengths, whereas
>     I'll need to be plotting X*Y points (256*256). Is there some way that I
>     could achieve this?
>
>     Thanks,
>
>     Will.
>     _______________________________________________
>     Matplotlib-users mailing list
>     Matplotlib-users at python.org <mailto:Matplotlib-users at python.org>
>     https://mail.python.org/mailman/listinfo/matplotlib-users
>
```