mpl_display.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:statistical_mechanics_teaching 作者: mabau 项目源码 文件源码
def __init__(self, sim, fig, grid=[3, 3], display_interval=100, type_to_color=None):
        """
        Create new animation showing results of molecular dynamics simulation

        :param sim: simulation instance
        :param fig: matplotlib figure
        :param grid: size of the plot grid, i.e. how many spaces where plots can be positioned to
        :param display_interval: how many time steps to run before a new animation frame is drawn
        :param type_to_color: array of matplotlib colors ith same length as there are particle types in the simulation,
                              mapping each particle type to a color
        """
        self._sim = sim
        self._fig = fig
        self._display_interval = display_interval
        self._animators = []
        self._grid_spec = matplotlib.gridspec.GridSpec(*grid)
        self._type_to_color = type_to_color
        self._frame_callbacks = []

        if not self._type_to_color:
            self._type_to_color = get_default_particle_colors(sim.nr_of_atom_types)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号