# Path: ecell4/util/session.py
# def load_world(filename):
#     """
#     Load a world from the given HDF5 filename.
#     The return type is determined by ``ecell4_base.core.load_version_information``.
# 
#     Parameters
#     ----------
#     filename : str
#         A HDF5 filename.
# 
#     Returns
#     -------
#     w : World
#         Return one from ``BDWorld``, ``EGFRDWorld``, ``MesoscopicWorld``,
#         ``ODEWorld``, ``GillespieWorld`` and ``SpatiocyteWorld``.
# 
#     """
#     vinfo = ecell4_base.core.load_version_information(filename)
#     if vinfo.startswith("ecell4-bd"):
#         return ecell4_base.bd.World(filename)
#     elif vinfo.startswith("ecell4-egfrd"):
#         return ecell4_base.egfrd.World(filename)
#     elif vinfo.startswith("ecell4-meso"):
#         return ecell4_base.meso.World(filename)
#     elif vinfo.startswith("ecell4-ode"):
#         return ecell4_base.ode.World(filename)
#     elif vinfo.startswith("ecell4-gillespie"):
#         return ecell4_base.gillespie.World(filename)
#     elif vinfo.startswith("ecell4-spatiocyte"):
#         return ecell4_base.spatiocyte.World(filename)
#     elif vinfo == "":
#         raise RuntimeError("No version information was found in [{0}]".format(filename))
#     raise RuntimeError("Unknown version information [{0}]".format(vinfo))
# 
# Path: ecell4/plotting/_core.py
# def eval_key(observable, targets, data, err=None):
#     assert len(data) == len(targets) + 1
#     assert err is None or len(err) == len(data)
# 
#     from ecell4.util.decorator_base import just_parse
#     parsed = just_parse().eval(observable)
# 
#     import numpy
#     variables = dict(zip(targets, data[1: ]))
# 
#     #XXX: The second return value is for standard deviations (err)
#     return (dispatch(parsed, EvalVisitor(variables)), None)
# 
# 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


import random
import types
    import plotly.offline
        import google.colab
        import plotly.io as pio
    import numpy
    import plotly
    import plotly.graph_objs as go
    import plotly.graph_objs as go
    import numpy
    import plotly
    import plotly.graph_objs as go
    import plotly
    import plotly.graph_objs as go
    import numpy
    import plotly
    import plotly.graph_objs as go
from ..util.session import load_world
from ._core import eval_key
from .styles import plotly_color_scale
    from stl import mesh  # numpy-stl
    from ecell4_base.core import Species
    if y_keys is not None and isinstance(y_keys, str):
        y_keys = (y_keys, )

    init_notebook_mode()
    fig = go.Figure()

    data, xdata = None, None
    for obs in args:
        if isinstance(obs, types.FunctionType):
            if xdata is None:
                raise ValueError("A function must be given after an observer.")
            y = [obs(xi) for xi in xdata]
            label = obs.__name__
            showlegend = (label not in color_scale.get_config())
            trace = go.Scatter(
                    x=xdata, y=y, name=label, line_color=color_scale.get_color(label),
                    legendgroup=label, showlegend=showlegend)
            fig.add_trace(trace)
            continue

        data = numpy.array(obs.data()).T

        if x_key is not None:
            xdata, _ = eval_key(x_key, obs.targets(), data)
        else:
            xdata = data[0]

        if y_keys is not None:
            targets_ = []
            for serial in y_keys:

# Path: ecell4/util/session.py
# def load_world(filename):
#     """
#     Load a world from the given HDF5 filename.
#     The return type is determined by ``ecell4_base.core.load_version_information``.
# 
#     Parameters
#     ----------
#     filename : str
#         A HDF5 filename.
# 
#     Returns
#     -------
#     w : World
#         Return one from ``BDWorld``, ``EGFRDWorld``, ``MesoscopicWorld``,
#         ``ODEWorld``, ``GillespieWorld`` and ``SpatiocyteWorld``.
# 
#     """
#     vinfo = ecell4_base.core.load_version_information(filename)
#     if vinfo.startswith("ecell4-bd"):
#         return ecell4_base.bd.World(filename)
#     elif vinfo.startswith("ecell4-egfrd"):
#         return ecell4_base.egfrd.World(filename)
#     elif vinfo.startswith("ecell4-meso"):
#         return ecell4_base.meso.World(filename)
#     elif vinfo.startswith("ecell4-ode"):
#         return ecell4_base.ode.World(filename)
#     elif vinfo.startswith("ecell4-gillespie"):
#         return ecell4_base.gillespie.World(filename)
#     elif vinfo.startswith("ecell4-spatiocyte"):
#         return ecell4_base.spatiocyte.World(filename)
#     elif vinfo == "":
#         raise RuntimeError("No version information was found in [{0}]".format(filename))
#     raise RuntimeError("Unknown version information [{0}]".format(vinfo))
# 
# Path: ecell4/plotting/_core.py
# def eval_key(observable, targets, data, err=None):
#     assert len(data) == len(targets) + 1
#     assert err is None or len(err) == len(data)
# 
#     from ecell4.util.decorator_base import just_parse
#     parsed = just_parse().eval(observable)
# 
#     import numpy
#     variables = dict(zip(targets, data[1: ]))
# 
#     #XXX: The second return value is for standard deviations (err)
#     return (dispatch(parsed, EvalVisitor(variables)), None)
# 
# 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/_plotly.py
import random
import types
    import plotly.offline
        import google.colab
        import plotly.io as pio
    import numpy
    import plotly
    import plotly.graph_objs as go
    import plotly.graph_objs as go
    import numpy
    import plotly
    import plotly.graph_objs as go
    import plotly
    import plotly.graph_objs as go
    import numpy
    import plotly
    import plotly.graph_objs as go
from ..util.session import load_world
from ._core import eval_key
from .styles import plotly_color_scale
    from stl import mesh  # numpy-stl
    from ecell4_base.core import Species

    if y_keys is not None and isinstance(y_keys, str):
        y_keys = (y_keys, )

    init_notebook_mode()
    fig = go.Figure()

    data, xdata = None, None
    for obs in args:
        if isinstance(obs, types.FunctionType):
            if xdata is None:
                raise ValueError("A function must be given after an observer.")
            y = [obs(xi) for xi in xdata]
            label = obs.__name__
            showlegend = (label not in color_scale.get_config())
            trace = go.Scatter(
                    x=xdata, y=y, name=label, line_color=color_scale.get_color(label),
                    legendgroup=label, showlegend=showlegend)
            fig.add_trace(trace)
            continue

        data = numpy.array(obs.data()).T

        if x_key is not None:
            xdata, _ = eval_key(x_key, obs.targets(), data)
        else:
            xdata = data[0]

        if y_keys is not None:
            targets_ = []
            for serial in y_keys:

                data_, err_ = eval_key(serial, obs.targets(), data)