Black Lives Matter. Please consider donating to Black Girls Code today.

3D plot, what does X and Y data do?

I have created a plot using Z data but I am curious as to the actual purpose of X and Y data. What functionality does adding X or Y data have for a graph?

The X and Y data provide the X and Y coordinates associated with the Z data. If you don’t provide X and Y, Z is assumed to be on a regular square grid. However, sometimes you may have irregularly spaced Z data – on a curvilinear grid, for instance, or a triangular mesh, or even (for a scatter3d plot) randomly spaced in the X and Y dimensions. Or you may have X and Y on a rectangular grid, but with a lot more data points near certain X and Y values than others – for instance, to resolve a sharp gradient in Z.

Thanks for the answer! Once I started playing around with different X and Y values it started to make sense.