I have a z function that accepts x and y parameters and returns a z output. I want to plot this in 3d and set the scales. How can I do this easily? I’ve spent way too much time looking through the documentation and not once do I see a way to do this.
Share
The plotting style depends on your data: are you trying to plot a 3D curve (line), a surface, or a scatter of points?
In the first example below I’ve just used a simple grid of evenly spaced points in the x-y plane for the domain. Generally, you first create a domain of xs and ys, and then calculate the zs from that.
This code should give you a working example to start playing with:
For surfaces it’s a bit different, you pass in a grid for the domain in 2d arrays. Here’s a smooth surface example:
For many more examples, check out the mplot3d tutorial in the docs.