How to obtain 3D colored surface via Python?

后端 未结 4 2275
眼角桃花
眼角桃花 2020-12-06 12:54

How to obtain the following surface via Matplotlib?

It is easy in matlab via:

mesh(peaks)

It seems matplotlib does not have an exac

4条回答
  •  难免孤独
    2020-12-06 13:47

    While answering another question I found that you can easily do this using plot_surface to produce a color mapped surface, and then exchanging face and edge colors:

    surf = ax.plot_surface(X, Y, Z, rstride=2, cstride=2, shade=False, cmap="jet", linewidth=1)
    draw()
    surf.set_edgecolors(surf.to_rgba(surf._A))
    surf.set_facecolors("white")
    show()
    

    produces

    The disadvantage this solution has over the other one is that the edges do not have smooth, per-pixel colouring, but one single color each.

提交回复
热议问题