Visualization of 3D-numpy-array frame by frame

前端 未结 2 541
花落未央
花落未央 2020-12-06 03:30
# -*- coding: utf-8 -*-
\"\"\"
slider 3D numpy array

\"\"\"

import numpy
import pylab
from matplotlib.widgets import Slider

data = numpy.random.rand(100,256,256)          


        
2条回答
  •  余生分开走
    2020-12-06 03:44

    Try re-writing the update function as

    def update(val):
        frame = numpy.around(sframe.val)
        l.set_data(data[frame,:,:])
    

    so that you do not need to re-create all of the matplotlib objects every update

提交回复
热议问题