# Path: ecell4/plotting/styles.py
# def periodic_color_scale(color_list):
#         def __init__(self, config=None):
#         def get_color(self, name):
#         def get_config(self):
#     class PeriodicColorScale:
#         COLORS = color_list
# 
# Path: ecell4/plotting/_core.py
# def get_range_of_world(world, scale=1.0):
#     edge_lengths = world.edge_lengths() * scale
#     max_length = max(tuple(edge_lengths))
# 
#     rangex = [(edge_lengths[0] - max_length) * 0.5,
#               (edge_lengths[0] + max_length) * 0.5]
#     rangey = [(edge_lengths[1] - max_length) * 0.5,
#               (edge_lengths[1] + max_length) * 0.5]
#     rangez = [(edge_lengths[2] - max_length) * 0.5,
#               (edge_lengths[2] + max_length) * 0.5]
# 
#     return {'x': rangex, 'y': rangey, 'z': rangez}
# 
# def get_range_of_trajectories(data, plot_range=None):
#     from ecell4_base.core import Real3
# 
#     if plot_range is None:
#         if len(data) == 0:
#             xmin, xmax, ymin, ymax, zmin, zmax = 0, 1, 0, 1, 0, 1
#         else:
#             xmin, xmax, ymin, ymax, zmin, zmax = None, None, None, None, None, None
# 
#             for i, traj in enumerate(data):
#                 xarr, yarr, zarr = [], [], []
#                 for pos in traj:
#                     xarr.append(pos[0])
#                     yarr.append(pos[1])
#                     zarr.append(pos[2])
# 
#                 if xmin is None:
#                     if len(traj) > 0:
#                         xmin, xmax = min(xarr), max(xarr)
#                         ymin, ymax = min(yarr), max(yarr)
#                         zmin, zmax = min(zarr), max(zarr)
#                 else:
#                     xmin, xmax = min([xmin] + xarr), max([xmax] + xarr)
#                     ymin, ymax = min([ymin] + yarr), max([ymax] + yarr)
#                     zmin, zmax = min([zmin] + zarr), max([zmax] + zarr)
# 
#         max_length = max(xmax - xmin, ymax - ymin, zmax - zmin)
#         rangex = [(xmin + xmax - max_length) * 0.5,
#                   (xmin + xmax + max_length) * 0.5]
#         rangey = [(ymin + ymax - max_length) * 0.5,
#                   (ymin + ymax + max_length) * 0.5]
#         rangez = [(zmin + zmax - max_length) * 0.5,
#                   (zmin + zmax + max_length) * 0.5]
# 
#         return {'x': rangex, 'y': rangey, 'z': rangez}
#     elif isinstance(plot_range, dict):
#         return plot_range
#     elif isinstance(plot_range, (list, tuple)):
#         if len(plot_range) != 3:
#             raise ValueError(
#                 'The size of plot_range [{}] must be 3.'.format(len(plot_range)))
#         elif (isinstance(plot_range[0], (list, tuple)) and
#                 isinstance(plot_range[1], (list, tuple)) and
#                 isinstance(plot_range[2], (list, tuple))):
#             return {'x': plot_range[0], 'y': plot_range[1], 'z': plot_range[2]}
#         else:
#             return {'x': (0, plot_range[0]),
#                     'y': (0, plot_range[1]),
#                     'z': (0, plot_range[2])}
#     elif isinstance(plot_range, Real3):
#         return {'x': (0, plot_range[0]),
#                 'y': (0, plot_range[1]),
#                 'z': (0, plot_range[2])}
#     else:
#         raise ValueError(
#             'plot_range must be list, tuple or dict. [{}] was given.'.format(
#                 repr(plot_range)))


import uuid
import json
import random
    import pkgutil
    import numpy
    import numpy
from .styles import default_color_scale
from ._core import get_range_of_world, get_range_of_trajectories
    from jinja2 import Template
    from IPython.display import display, HTML
    from IPython.core.display import display, HTML
    from ecell4_base.core import Species
    from IPython.core.display import display, HTML
    from IPython.core.display import display, HTML
    from jinja2 import Template
    from IPython.core.display import display, HTML
    from PIL import Image
    from base64 import b64encode
    from tempfile import TemporaryFile
    from math import sqrt
    from IPython.core.display import display, HTML
    from functools import reduce
        Height of the plotting area.
    config : dict, default {}
        Dict for configure default colors. Its values are colors unique
        to each speices. The dictionary will be updated during this plot.
        Colors included in config dict will never be used for other speices.
    species_list : array of string, default None
        If set, plot_movie will not search the list of species

    """
    config = config or {}


    data = {}
    sizes = {}
    for i, world in enumerate(worlds):
        species = __parse_world(world, radius, species_list)
        for species_info in species:
            if data.get(species_info['name']) is None:
                data[species_info['name']] = []
            data[species_info['name']].append({
                'df': species_info['data'],
                't': i
            })
            sizes[species_info['name']] = species_info['size']

    options = {
        'player': True,
        'autorange': False,
        'space_mode': 'wireframe',
        'grid': grid,

# Path: ecell4/plotting/styles.py
# def periodic_color_scale(color_list):
#         def __init__(self, config=None):
#         def get_color(self, name):
#         def get_config(self):
#     class PeriodicColorScale:
#         COLORS = color_list
# 
# Path: ecell4/plotting/_core.py
# def get_range_of_world(world, scale=1.0):
#     edge_lengths = world.edge_lengths() * scale
#     max_length = max(tuple(edge_lengths))
# 
#     rangex = [(edge_lengths[0] - max_length) * 0.5,
#               (edge_lengths[0] + max_length) * 0.5]
#     rangey = [(edge_lengths[1] - max_length) * 0.5,
#               (edge_lengths[1] + max_length) * 0.5]
#     rangez = [(edge_lengths[2] - max_length) * 0.5,
#               (edge_lengths[2] + max_length) * 0.5]
# 
#     return {'x': rangex, 'y': rangey, 'z': rangez}
# 
# def get_range_of_trajectories(data, plot_range=None):
#     from ecell4_base.core import Real3
# 
#     if plot_range is None:
#         if len(data) == 0:
#             xmin, xmax, ymin, ymax, zmin, zmax = 0, 1, 0, 1, 0, 1
#         else:
#             xmin, xmax, ymin, ymax, zmin, zmax = None, None, None, None, None, None
# 
#             for i, traj in enumerate(data):
#                 xarr, yarr, zarr = [], [], []
#                 for pos in traj:
#                     xarr.append(pos[0])
#                     yarr.append(pos[1])
#                     zarr.append(pos[2])
# 
#                 if xmin is None:
#                     if len(traj) > 0:
#                         xmin, xmax = min(xarr), max(xarr)
#                         ymin, ymax = min(yarr), max(yarr)
#                         zmin, zmax = min(zarr), max(zarr)
#                 else:
#                     xmin, xmax = min([xmin] + xarr), max([xmax] + xarr)
#                     ymin, ymax = min([ymin] + yarr), max([ymax] + yarr)
#                     zmin, zmax = min([zmin] + zarr), max([zmax] + zarr)
# 
#         max_length = max(xmax - xmin, ymax - ymin, zmax - zmin)
#         rangex = [(xmin + xmax - max_length) * 0.5,
#                   (xmin + xmax + max_length) * 0.5]
#         rangey = [(ymin + ymax - max_length) * 0.5,
#                   (ymin + ymax + max_length) * 0.5]
#         rangez = [(zmin + zmax - max_length) * 0.5,
#                   (zmin + zmax + max_length) * 0.5]
# 
#         return {'x': rangex, 'y': rangey, 'z': rangez}
#     elif isinstance(plot_range, dict):
#         return plot_range
#     elif isinstance(plot_range, (list, tuple)):
#         if len(plot_range) != 3:
#             raise ValueError(
#                 'The size of plot_range [{}] must be 3.'.format(len(plot_range)))
#         elif (isinstance(plot_range[0], (list, tuple)) and
#                 isinstance(plot_range[1], (list, tuple)) and
#                 isinstance(plot_range[2], (list, tuple))):
#             return {'x': plot_range[0], 'y': plot_range[1], 'z': plot_range[2]}
#         else:
#             return {'x': (0, plot_range[0]),
#                     'y': (0, plot_range[1]),
#                     'z': (0, plot_range[2])}
#     elif isinstance(plot_range, Real3):
#         return {'x': (0, plot_range[0]),
#                 'y': (0, plot_range[1]),
#                 'z': (0, plot_range[2])}
#     else:
#         raise ValueError(
#             'plot_range must be list, tuple or dict. [{}] was given.'.format(
#                 repr(plot_range)))


# Path: ecell4/plotting/_elegans.py
import uuid
import json
import random
    import pkgutil
    import numpy
    import numpy
from .styles import default_color_scale
from ._core import get_range_of_world, get_range_of_trajectories
    from jinja2 import Template
    from IPython.display import display, HTML
    from IPython.core.display import display, HTML
    from ecell4_base.core import Species
    from IPython.core.display import display, HTML
    from IPython.core.display import display, HTML
    from jinja2 import Template
    from IPython.core.display import display, HTML
    from PIL import Image
    from base64 import b64encode
    from tempfile import TemporaryFile
    from math import sqrt
    from IPython.core.display import display, HTML
    from functools import reduce

        Height of the plotting area.
    config : dict, default {}
        Dict for configure default colors. Its values are colors unique
        to each speices. The dictionary will be updated during this plot.
        Colors included in config dict will never be used for other speices.
    species_list : array of string, default None
        If set, plot_movie will not search the list of species

    """
    config = config or {}


    data = {}
    sizes = {}
    for i, world in enumerate(worlds):
        species = __parse_world(world, radius, species_list)
        for species_info in species:
            if data.get(species_info['name']) is None:
                data[species_info['name']] = []
            data[species_info['name']].append({
                'df': species_info['data'],
                't': i
            })
            sizes[species_info['name']] = species_info['size']

    options = {
        'player': True,
        'autorange': False,
        'space_mode': 'wireframe',
        'grid': grid,

        'range': get_range_of_world(worlds[0])