def plot_trajectory_with_elegans(<EOL>obs, width=<NUM_LIT>, height=<NUM_LIT>, config=None, grid=True, wireframe=False,<EOL>max_count=<NUM_LIT:10>, camera_position=(-<NUM_LIT>, <NUM_LIT>, <NUM_LIT:32>), camera_rotation=(-<NUM_LIT>, <NUM_LIT:0.5>, <NUM_LIT>),<EOL>plot_range=None):
config = config or {}<EOL>from IPython.core.display import display, HTML<EOL>color_scale = default_color_scale(config=config)<EOL>plots = []<EOL>xmin, xmax, ymin, ymax, zmin, zmax = None, None, None, None, None, None<EOL>data = obs.data()<EOL>if max_count is not None and len(data) > max_count:<EOL><INDENT>data = random.sample(data, max_count)<EOL><DEDENT>for i, y in enumerate(data):<EOL><INDENT>xarr, yarr, zarr = [], [], []<EOL>for pos in y:<EOL><INDENT>xarr.append(pos[<NUM_LIT:0>])<EOL>yarr.append(pos[<NUM_LIT:1>])<EOL>zarr.append(pos[<NUM_LIT:2>])<EOL><DEDENT>if xmin is None:<EOL><INDENT>if len(y) > <NUM_LIT:0>:<EOL><INDENT>xmin, xmax = min(xarr), max(xarr)<EOL>ymin, ymax = min(yarr), max(yarr)<EOL>zmin, zmax = min(zarr), max(zarr)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>xmin, xmax = min([xmin] + xarr), max([xmax] + xarr)<EOL>ymin, ymax = min([ymin] + yarr), max([ymax] + yarr)<EOL>zmin, zmax = min([zmin] + zarr), max([zmax] + zarr)<EOL><DEDENT>name = str(i + <NUM_LIT:1>)<EOL>c = color_scale.get_color(name)<EOL>plots.append({<EOL>'<STR_LIT:type>': '<STR_LIT>',<EOL>'<STR_LIT:data>': {'<STR_LIT:x>': xarr, '<STR_LIT:y>': yarr, '<STR_LIT:z>': zarr},<EOL>'<STR_LIT>': {<EOL>'<STR_LIT:name>': name,<EOL>'<STR_LIT>': <NUM_LIT:2>,  <EOL>'<STR_LIT>': [c, c]}<EOL>})<EOL><DEDENT>if plot_range is None:<EOL><INDENT>if xmin is None:<EOL><INDENT>xmin, xmax, ymin, ymax, zmin, zmax = <NUM_LIT:0>, <NUM_LIT:1>, <NUM_LIT:0>, <NUM_LIT:1>, <NUM_LIT:0>, <NUM_LIT:1><EOL><DEDENT>max_length = max(xmax - xmin, ymax - ymin, zmax - zmin)<EOL>rangex = [(xmin + xmax - max_length) * <NUM_LIT:0.5>,<EOL>(xmin + xmax + max_length) * <NUM_LIT:0.5>]<EOL>rangey = [(ymin + ymax - max_length) * <NUM_LIT:0.5>,<EOL>(ymin + ymax + max_length) * <NUM_LIT:0.5>]<EOL>rangez = [(zmin + zmax - max_length) * <NUM_LIT:0.5>,<EOL>(zmin + zmax + max_length) * <NUM_LIT:0.5>]<EOL>wrange = {'<STR_LIT:x>': rangex, '<STR_LIT:y>': rangey, '<STR_LIT:z>': rangez}<EOL><DEDENT>else:<EOL><INDENT>wrange = __get_range_of_trajectories(None, plot_range)<EOL><DEDENT>model = {<EOL>'<STR_LIT>': plots,<EOL>'<STR_LIT>': {<EOL>'<STR_LIT>': width,<EOL>'<STR_LIT>': height,<EOL>'<STR_LIT>': wrange,<EOL>'<STR_LIT>': False,<EOL>'<STR_LIT>': grid,<EOL>'<STR_LIT>': True<EOL>}<EOL>}<EOL>if wireframe:<EOL><INDENT>model['<STR_LIT>']['<STR_LIT>'] = '<STR_LIT>'<EOL><DEDENT>model_id = '<STR_LIT>' + str(uuid.uuid4()) + '<STR_LIT:">'<EOL>display(HTML(generate_html(<EOL>{'<STR_LIT>': json.dumps(model), '<STR_LIT>': model_id,<EOL>'<STR_LIT>': camera_position[<NUM_LIT:0>], '<STR_LIT>': camera_position[<NUM_LIT:1>], '<STR_LIT>': camera_position[<NUM_LIT:2>],<EOL>'<STR_LIT>': camera_rotation[<NUM_LIT:0>], '<STR_LIT>': camera_rotation[<NUM_LIT:1>], '<STR_LIT>': camera_rotation[<NUM_LIT:2>]},<EOL>'<STR_LIT>')))<EOL>
Generate a plot from received instance of TrajectoryObserver and show it
on IPython notebook.

Parameters
----------
obs : TrajectoryObserver
    TrajectoryObserver to render.
width : float, default 350
    Width of the plotting area.
height : float, default 350
    Height of the plotting area.
config : dict, default {}
    Dict for configure default colors. Its values are colors unique
    to each particle. The dictionary will be updated during this plot.
    Colors included in config dict will never be used for other particles.
camera_position : tuple, default (-30, 31, 42)
camera_rotaiton : tuple, default (-0.6, 0.5, 0.6)
    Initial position and rotation of camera.
plot_range : tuple, default None
    Range for plotting. A triplet of pairs suggesting (rangex, rangey, rangez).
    If None, the minimum volume containing all the trajectories is used.