plt.title('My Interpolated Opacity Transfer Function') plt.ylabel('Opacity') plt.xlabel('Index along scalar mapping') plt.show() ############################################################################### # That opacity mapping will have an opacity of 0.0 at the minimum scalar range, # a value or 0.9 at the middle of the scalar range, and a value of 0.3 at the # maximum of the scalar range: mesh.plot(opacity=opacity) ############################################################################### # Opacity mapping is often useful when plotting DICOM images. For example, # download the sample knee DICOM image: knee = examples.download_knee() ############################################################################### # And here we inspect the DICOM image with a few different opacity mappings: p = pv.Plotter(shape=(2, 2), border=False) p.add_mesh(knee, cmap="bone", stitle="No Opacity") p.view_xy() p.subplot(0, 1) p.add_mesh(knee, cmap="bone", opacity="linear", stitle="Linear Opacity") p.view_xy() p.subplot(1, 0) p.add_mesh(knee, cmap="bone", opacity="sigmoid", stitle="Sigmoidal Opacity") p.view_xy()
def test_download_knee(): data = examples.download_knee() assert data.n_cells