当前位置: 首页>>代码示例>>Python>>正文


Python FuncAnimation.__init__方法代码示例

本文整理汇总了Python中matplotlib.animation.FuncAnimation.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python FuncAnimation.__init__方法的具体用法?Python FuncAnimation.__init__怎么用?Python FuncAnimation.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.animation.FuncAnimation的用法示例。


在下文中一共展示了FuncAnimation.__init__方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from matplotlib.animation import FuncAnimation [as 别名]
# 或者: from matplotlib.animation.FuncAnimation import __init__ [as 别名]
    def __init__(self, fig, startFrame, endFrame, tail, fade=False, **kwargs) :
        """
        Create an animation of track segments.

        *fig*               matplotlib Figure object
        *startFrame*        The frame number to start animation loop at
        *endFrame*          The frame number to end the loop at
        *tail*              How many frames to keep older segments in view
        *fade*              Whether or not to fade track tails for
                            non-active tracks (default: False).

        All other :class:`FuncAnimation` constructor  kwargs are available
        except *frames* and *fargs*.

        TODO: Add usage info.
        """
        self._lineData = []
        self._lines = []
        if 'frames' in kwargs :
            raise KeyError("Do not specify 'frames' for the constructor"
                           " of SegAnimator")

        self.fade = fade

        FuncAnimation.__init__(self, fig, self.update_lines,
                                     endFrame - startFrame + 1,
                                     fargs=(self._lineData, self._lines,
                                            startFrame, endFrame, tail),
                                     **kwargs)
开发者ID:BVRoot,项目名称:ZigZag,代码行数:31,代码来源:TrackPlot.py

示例2: __init__

# 需要导入模块: from matplotlib.animation import FuncAnimation [as 别名]
# 或者: from matplotlib.animation.FuncAnimation import __init__ [as 别名]
    def __init__(self, fig, files, load_func=None, robust=False, **kwargs):
        """
        Create an animation object for viewing radar reflectivities.

        *fig*           matplotlib Figure object

        *files*         list of filenames containing the radar data

        *load_func*     The function to use to load the data from a file.
                        Must return a dictionary of 'vals' which contains
                        the 3D numpy array (T by Y by X), 'lats' and 'lons'.

                        It is also optional that the loading function also
                        provides a 'scan_time', either as a
                        :class:`datetime.datetime` object or as an integer
                        or a float representing the number of seconds since
                        UNIX Epoch.

        *frames*        The number of frames to display. If not given, then
                        assume it is the same number as 'len(files)'.

        *robust*        Boolean (default: False) indicating whether or not
                        we can assume all the data will be for the same domain.
                        If you can't assume a consistant domain, then set
                        *robust* to True.  This often happens for PAR data.
                        Note that a robust rendering is slower.

        All other kwargs for :class:`FuncAnimation` are also allowed.

        To use, specify the axes to display the image on using :meth:`add_axes`.
        """
        self._rd = files
        self._loadfunc = load_func if load_func is not None else LoadRastRadar

        self._ims = []
        self._im_kwargs = []
        self._new_axes = []
        self._curr_time = None
        self._robust = robust
        frames = kwargs.pop("frames", None)
        # if len(files) < frames :
        #    raise ValueError("Not enough data files for the number of frames")
        FuncAnimation.__init__(
            self,
            fig,
            self.nextframe,
            frames=len(self._rd),
            #                                     init_func=self.firstframe,
            **kwargs
        )
开发者ID:BVRoot,项目名称:BRadar,代码行数:52,代码来源:plotutils.py

示例3: __init__

# 需要导入模块: from matplotlib.animation import FuncAnimation [as 别名]
# 或者: from matplotlib.animation.FuncAnimation import __init__ [as 别名]
    def __init__(self, fig, grid, filelists,
                       load_funcs=None, robusts=False, **kwargs) :

        self._filelists = [cycle(files) for files in filelists]
        self._loadfunc = load_func if load_func is not None else LoadRastRadar
        self._curr_times = [None] * len(filelists)
        self._ims = [None] * len(filelists)
        self._datas = [None] * len(filelists)
        #self.im_kwargs = [None] * len(filelists)
        self._has_looped = [False] * len(filelists)
        self._grid = grid
        self.robust = robust

        FuncAnimation.__init__(self, fig, self.nexttick, blit=False,
                                          init_func=self.firsttick, **kwargs)
开发者ID:WeatherGod,项目名称:BRadar,代码行数:17,代码来源:radarmovie.py

示例4: __init__

# 需要导入模块: from matplotlib.animation import FuncAnimation [as 别名]
# 或者: from matplotlib.animation.FuncAnimation import __init__ [as 别名]
 def __init__(self, fig, func, frames=None, init_func=None, fargs=None,
              save_count=None, mini=0, maxi=100, pos=(0.2, 0.98), **kwargs):
     self.i = 0
     self.min = mini
     self.max = maxi
     self.runs = True
     self.forwards = True
     self.fig = fig
     self.func = func
     self.setup(pos)
     FuncAnimation.__init__(
         self, self.fig, self.update, frames=self.play(),
         init_func=init_func, fargs=fargs,
         save_count=save_count, **kwargs
     )
开发者ID:chemreac,项目名称:chemreac,代码行数:17,代码来源:_player.py

示例5: __init__

# 需要导入模块: from matplotlib.animation import FuncAnimation [as 别名]
# 或者: from matplotlib.animation.FuncAnimation import __init__ [as 别名]
    def __init__(self, figure, frameCnt, tail=0, fade=False, **kwargs):
        """
        Create an animation of the 'corners' (the centroids of detections).

        *figure*            The matplotlib Figure object
        *frameCnt*          The number of frames for the animation loop
        *tail*              The number of frames to hold older corners
        *fade*              Whether to fade older features (default: False).

        All other :class:`FuncAnimation` kwargs are available.

        TODO: Add usage information.
        """
        self._allcorners = []
        self._flatcorners = []
        self._myframeCnt = frameCnt
        self.fade = fade

        FuncAnimation.__init__(self, figure, self.update_corners, frameCnt, fargs=(self._allcorners, tail), **kwargs)
开发者ID:WeatherGod,项目名称:ZigZag,代码行数:21,代码来源:TrackPlot.py

示例6: __init__

# 需要导入模块: from matplotlib.animation import FuncAnimation [as 别名]
# 或者: from matplotlib.animation.FuncAnimation import __init__ [as 别名]
    def __init__(self, fig, files, load_func=None, robust=False,
                       sps=None, time_markers=None,
                       **kwargs) :
        """
        Create an animation object for viewing radar reflectivities.

        *fig*           matplotlib Figure object

        *files*         list of filenames containing the radar data

        *load_func*     The function to use to load the data from a file.
                        Must return a dictionary of 'vals' which contains
                        the 3D numpy array (T by Y by X), 'lats' and 'lons'.

                        It is also optional that the loading function also
                        provides a 'scan_time', either as a
                        :class:`datetime.datetime` object or as an integer
                        or a float representing the number of seconds since
                        UNIX Epoch.

        *robust*        Boolean (default: False) indicating whether or not
                        we can assume all the data will be for the same domain.
                        If you can't assume a consistant domain, then set
                        *robust* to True.  This often happens for PAR data.
                        Note that a robust rendering is slower.

        *sps*           The rate of data time for each second displayed.
                        Default: None (a data frame per display frame).

        *time_markers*  A list of time offsets (in seconds) for each frame.
                        If None, then autogenerate from the event_source
                        and data (unless *sps* is None).

        All other kwargs for :class:`FuncAnimation` are also allowed.

        To use, specify the axes to display the image on using
        :meth:`add_axes`. If no axes are added by draw time, then this class
        will use the current axes by default with no extra keywords.
        """
        #self._rd = files
        #self._loadfunc = load_func if load_func is not None else LoadRastRadar
        self._rd = RadarCache(files, cachewidth=3, load_func=load_func,
                              cyclable=True)

        self.startTime = self.curr_time
        self.endTime = self.prev_time

        self._ims = []
        self._im_kwargs = []
        self._new_axes = []
        #self._curr_time = None
        self._robust = robust
        frames = kwargs.pop('frames', None)
        #if len(files) < frames :
        #    raise ValueError("Not enough data files for the number of frames")
        self.time_markers = None
        FuncAnimation.__init__(self, fig, self.nextframe, #frames=len(self._rd),
                                     init_func=self.firstframe,
                                     **kwargs)

        self._sps = sps

        if time_markers is None :
            # Convert milliseconds per frame to frames per second
            self._fps = 1000.0 / self.event_source.interval
            if self._sps is not None :
                #timelen = (self.endTime - self.startTime)
                timestep = timedelta(0, self._sps / self._fps)

                currTime = self.startTime
                self.time_markers = [currTime]
                while currTime < self.endTime :
                    currTime += timestep
                    self.time_markers.append(currTime)
            else :
                # Don't even bother trying to make playback uniform.
                self.time_markers = None

        else :
            self.time_markers = time_markers
            self._fps = ((len(time_markers) - 1) /
                         ((self.time_markers[-1] -
                           self.time_markers[0]).total_seconds() / self._sps))
            self.event_source.interval = 1000.0 / self._fps
        self.save_count = (len(self.time_markers) if 
                           self.time_markers is not None else
                           len(self._rd))
开发者ID:WeatherGod,项目名称:BRadar,代码行数:89,代码来源:plotutils.py


注:本文中的matplotlib.animation.FuncAnimation.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。