def plot_movie2d_with_matplotlib(<EOL>worlds, plane='<STR_LIT>', marker_size=<NUM_LIT:3>, figsize=<NUM_LIT:6>, grid=True,<EOL>wireframe=False, species_list=None, max_count=None, angle=None, noaxis=False,<EOL>interval=<NUM_LIT>, repeat_delay=<NUM_LIT>, stride=<NUM_LIT:1>, rotate=None,<EOL>legend=True, scale=<NUM_LIT:1>, output=None, crf=<NUM_LIT:10>, bitrate='<STR_LIT>', **kwargs):
import matplotlib.pyplot as plt<EOL>import matplotlib.animation as animation<EOL>from ecell4_base.core import Species, FixedIntervalHDF5Observer<EOL>from .simulation import load_world<EOL>plane = plane.lower()<EOL>if len(plane) != <NUM_LIT:2> or plane[<NUM_LIT:0>] not in ('<STR_LIT:x>', '<STR_LIT:y>', '<STR_LIT:z>') or plane[<NUM_LIT:1>] not in ('<STR_LIT:x>', '<STR_LIT:y>', '<STR_LIT:z>'):<EOL><INDENT>raise ValueError("<STR_LIT>".format(repr(plane)))<EOL><DEDENT>xidx = <NUM_LIT:0> if plane[<NUM_LIT:0>] == '<STR_LIT:x>' else (<NUM_LIT:1> if plane[<NUM_LIT:0>] == '<STR_LIT:y>' else <NUM_LIT:2>)<EOL>yidx = <NUM_LIT:0> if plane[<NUM_LIT:1>] == '<STR_LIT:x>' else (<NUM_LIT:1> if plane[<NUM_LIT:1>] == '<STR_LIT:y>' else <NUM_LIT:2>)<EOL>if isinstance(worlds, FixedIntervalHDF5Observer):<EOL><INDENT>obs = worlds<EOL>worlds = []<EOL>for i in range(<NUM_LIT:0>, obs.num_steps(), stride):<EOL><INDENT>filename = obs.filename(i)<EOL>if os.path.isfile(filename):<EOL><INDENT>worlds.append(load_world(filename))<EOL><DEDENT>elif len(worlds) ><NUM_LIT:0>:<EOL><INDENT>worlds.append(worlds[-<NUM_LIT:1>])<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>worlds = worlds[:: stride]<EOL><DEDENT>if species_list is None:<EOL><INDENT>species_list = []<EOL>for world in worlds:<EOL><INDENT>species_list.extend(<EOL>[p.species().serial() for pid, p in world.list_particles()])<EOL>species_list = sorted(<EOL>set(species_list), key=species_list.index)  <EOL><DEDENT><DEDENT>wrange = __get_range_of_world(worlds[<NUM_LIT:0>], scale)<EOL>wrange = (wrange['<STR_LIT:x>'], wrange['<STR_LIT:y>'], wrange['<STR_LIT:z>'])<EOL>wrange = {'<STR_LIT:x>': wrange[xidx], '<STR_LIT:y>': wrange[yidx]}<EOL>fig = plt.figure(figsize=(figsize, figsize))<EOL>ax = fig.gca()<EOL>color_scale = matplotlib_color_scale()<EOL>def _update_plot(i, worlds, species_list):<EOL><INDENT>ax.cla()<EOL>ax.set_aspect('<STR_LIT>')<EOL>ax.grid(grid)<EOL>ax.set_xlim(*wrange['<STR_LIT:x>'])<EOL>ax.set_ylim(*wrange['<STR_LIT:y>'])<EOL>ax.set_xlabel(plane[<NUM_LIT:0>].upper())<EOL>ax.set_ylabel(plane[<NUM_LIT:1>].upper())<EOL>if noaxis:<EOL><INDENT>ax.set_axis_off()<EOL><DEDENT>_legend = False<EOL>world = worlds[i]<EOL>for i, name in enumerate(species_list):<EOL><INDENT>offsets = ([], [])<EOL>particles = world.list_particles_exact(Species(name))<EOL>if len(particles) == <NUM_LIT:0>:<EOL><INDENT>continue<EOL><DEDENT>_legend = True<EOL>if max_count is not None and len(particles) > max_count:<EOL><INDENT>particles = random.sample(particles, max_count)<EOL><DEDENT>for pid, p in particles:<EOL><INDENT>pos = p.position() * scale<EOL>offsets[<NUM_LIT:0>].append(pos[xidx])<EOL>offsets[<NUM_LIT:1>].append(pos[yidx])<EOL><DEDENT>ax.scatter(<EOL>offsets[<NUM_LIT:0>], offsets[<NUM_LIT:1>], marker='<STR_LIT:o>', s=(<NUM_LIT:2> ** marker_size),<EOL>lw=<NUM_LIT:0>, facecolor=color_scale.get_color(name), label=name)<EOL><DEDENT>if legend is not None and legend is not False and _legend:<EOL><INDENT>legend_opts = {"<STR_LIT>": "<STR_LIT>", "<STR_LIT>": True}<EOL>if isinstance(legend, dict):<EOL><INDENT>legend_opts.update(legend)<EOL><DEDENT>ax.legend(**legend_opts)<EOL><DEDENT>fig.canvas.draw()<EOL><DEDENT>ani = animation.FuncAnimation(<EOL>fig, _update_plot, fargs=(worlds, species_list),<EOL>frames=len(worlds), interval=interval, blit=False)<EOL>plt.close(ani._fig)<EOL>display_anim(ani, output, fps=<NUM_LIT:1.0> / interval, crf=crf, bitrate=bitrate)<EOL>
Generate a movie projected on the given plane from the received list
of instances of World, and show it on IPython notebook.
This function may require ffmpeg.

Parameters
----------
worlds : list or FixedIntervalHDF5Observer
    A list of Worlds to render.
plane : str, default 'xy'
    'xy', 'yz', 'zx'.
marker_size : float, default 3
    Marker size for all species. Size is passed to scatter function
    as argument, s=(2 ** marker_size).
figsize : float, default 6
    Size of the plotting area. Given in inch.
species_list : array of string, default None
    If set, plot_world will not search the list of species.
max_count : Integer, default None
    The maximum number of particles to show for each species.
    None means no limitation.
angle : tuple, default None
    A tuple of view angle which is given as (azim, elev, dist).
    If None, use default assumed to be (-60, 30, 10).
interval : Integer, default 0.16
    Parameters for matplotlib.animation.ArtistAnimation.
stride : Integer, default 1
    Stride per frame.
rotate : tuple, default None
    A pair of rotation angles, elev and azim, for animation.
    None means no rotation, same as (0, 0).
legend : bool, default True
scale : float, default 1
    A length-scaling factor
output : str, default None
    An output filename. '.webm' or '.mp4' is only accepted.
    If None, display a movie on IPython Notebook.
crf : int, default 10
    The CRF value can be from 4-63. Lower values mean better quality.
bitrate : str, default '1M'
    Target bitrate