Plotting a 2d Array with mplot3d

前端 未结 4 1842
一整个雨季
一整个雨季 2021-01-31 20:40

I have a 2D numpy array and I want to plot it in 3D. I heard about mplot3d but I cant get to work properly

Here\'s an example of what I want to do. I have an array with

4条回答
  •  有刺的猬
    2021-01-31 21:02

    You can find the answer in one of the examples of the Matplotlib gallery; the 3D examples are towards the end.

    More generally, the Matplotlib gallery is a great first-stop resource, for finding how to do some plots.

    The examples I looked at essentially work with three 2D arrays: one with all the x values, one with all the y values, and the last one with all the z values. So, one solution is to create the arrays of x and y values (with meshgrid(), for instance).

提交回复
热议问题