zoukankan      html  css  js  c++  java
  • 显示三维体素

    Matplotlib发布新版本3.1,新版本带来了那些新的功能和特性。

    Axes3D.voxels对结果voxels进行着色,voxels()方法默认shade参数改True。它会根据方向调整阴影,其行为与trisurf()以及bar3d()的匹配参数相同。

    示例代码:

    示例代码:
    %matplotlib inline
    import matplotlib.pyplot as plt
    import numpy as np
    x, y, z = np.indices((8, 8, 8))
    cube1 = (x < 3) & (y < 3) & (z < 3)
    cube2 = (x >= 5) & (y >= 5) & (z >= 5)
    link = abs(x - y) + abs(y - z) + abs(z - x) <= 2
    voxels = cube1 | cube2 | link
    colors = np.empty(voxels.shape, dtype=object)
    colors[link] = 'red'
    colors[cube1] = 'blue'
    colors[cube2] = 'green'
    fig = plt.figure(figsize=plt.figaspect(0.5))
    ax, ax_shaded = fig.subplots(1, 2, subplot_kw=dict(projection='3d'))
    ax.voxels(voxels, facecolors=colors, edgecolor='k', shade=False)
    ax.set_title("Unshaded")
    ax_shaded.voxels(voxels, facecolors=colors, edgecolor='k', shade=True)
    ax_shaded.set_title("Shaded (default)")
    plt.show()

  • 相关阅读:
    ajax跨域名
    js(鼠标键盘拖动事件)
    关于servlet转发和重新定向
    ztree的异步加载
    关于三层(dao,serviece,servlet)
    serclet监听器
    servlet(2)response常用方法
    servlet(1)request常用方法
    .post
    A1146 Topological Order
  • 原文地址:https://www.cnblogs.com/chamie/p/11860984.html
Copyright © 2011-2022 走看看