tyssue.draw package#

Submodules#

tyssue.draw.ipv_draw module#

3D visualisation inside the notebook.

tyssue.draw.ipv_draw.browse_history(history, coords=['x', 'y', 'z'], start=None, stop=None, size=None, **draw_specs_kw)[source]#
tyssue.draw.ipv_draw.edge_mesh(sheet, coords, **edge_specs)[source]#

Creates a ipyvolume Mesh of the edge lines to be displayed in Jupyter Notebooks

Returns

mesh

Return type

a ipyvolume.widgets.Mesh mesh widget

tyssue.draw.ipv_draw.face_mesh(sheet, coords, **face_draw_specs)[source]#

Creates a ipyvolume Mesh of the face polygons

tyssue.draw.ipv_draw.sheet_view(sheet, coords=['x', 'y', 'z'], **draw_specs_kw)[source]#

Creates a javascript renderer of the edge lines to be displayed in Jupyter Notebooks

Returns

  • fig (a ipyvolume.widgets.Figure widget)

  • mesh (a ipyvolume.widgets.Mesh mesh widget)

tyssue.draw.ipv_draw.update_view(fig, meshes)[source]#
tyssue.draw.ipv_draw.view_ipv(sheet, coords=['x', 'y', 'z'], **edge_specs)[source]#

Creates a javascript renderer of the edge lines to be displayed in Jupyter Notebooks

Returns

  • fig (a ipyvolume.widgets.Figure widget)

  • mesh (a ipyvolume.widgets.Mesh mesh widget)

tyssue.draw.plt_draw module#

Matplotlib based plotting

tyssue.draw.plt_draw.browse_history(history, coords=['x', 'y'], start=None, stop=None, size=None, draw_func=None, margin=5, **draw_kwds)[source]#

Returns a browser widget with 2D plots of the epithelium

tyssue.draw.plt_draw.create_gif(history, output, num_frames=None, interval=None, draw_func=None, margin=5, **draw_kwds)[source]#

Creates an animated gif of the recorded history.

You need imagemagick on your system for this function to work.

Parameters
  • history (a tyssue.History object) –

  • output (path to the output gif file) –

  • num_frames (int, the number of frames in the gif) –

  • interval (tuples, define begin and end frame of the gif) –

  • draw_func (a drawing function) – this function must take a sheet object as first argument and return a fig, ax pair. Defaults to quick_edge_draw (aka sheet_view with quick mode)

  • margin (int, the graph margins in percents, default 5) – if margin is -1, let the draw function decide

  • function (**draw_kwds are passed to the drawing) –

tyssue.draw.plt_draw.curved_view(sheet, radius_cutoff=1000.0)[source]#
tyssue.draw.plt_draw.draw_edge(sheet, coords, ax, **draw_spec_kw)[source]#
tyssue.draw.plt_draw.draw_face(sheet, coords, ax, **draw_spec_kw)[source]#

Draws epithelial sheet polygonal faces in matplotlib Keyword values can be specified at the element level as columns of the sheet.face_df

tyssue.draw.plt_draw.draw_vert(sheet, coords, ax, **draw_spec_kw)[source]#

Draw junction vertices in matplotlib.

tyssue.draw.plt_draw.get_arc_data(sheet)[source]#
tyssue.draw.plt_draw.parse_face_specs(face_draw_specs, sheet)[source]#
tyssue.draw.plt_draw.plot_forces(sheet, geom, model, coords, scaling, ax=None, approx_grad=None, **draw_specs_kw)[source]#

Plot the net forces at each vertex, with their amplitudes multiplied by scaling. To be clear, this is the oposite of the gradient - grad E.

tyssue.draw.plt_draw.plot_junction(eptm, edge_index, coords=['x', 'y'])[source]#

Plots local graph around a junction, for debugging purposes.

tyssue.draw.plt_draw.plot_scaled_energies(sheet, geom, model, scales, ax=None)[source]#

Plot scaled energies

Parameters
  • sheet (a:class: Sheet object) –

  • geom (a Geometry class) –

  • model (a :class:'Model') –

  • scales (np.linspace of float) –

Returns

  • fig (a :class:matplotlib.figure.Figure instance)

  • ax (:class:matplotlib.Axes instance, default None)

tyssue.draw.plt_draw.quick_edge_draw(sheet, coords=['x', 'y'], ax=None, **draw_spec_kw)[source]#
tyssue.draw.plt_draw.sheet_view(sheet, coords=['x', 'y'], ax=None, cbar_axis=None, **draw_specs_kw)[source]#

Base view function, parametrizable through draw_secs The default sheet_spec specification is: {

“edge”: {

“visible”: true, “width”: 0.5, “head_width”: 0.0, “length_includes_head”: true, “shape”: “right”, “color”: “#2b5d0a”, “alpha”: 0.8, “zorder”: 1, “colormap”: “viridis”

}, “vert”: {

“visible”: false, “s”: 100, “color”: “#000a4b”, “alpha”: 0.3, “zorder”: 2

}, “grad”: {

“color”:”#000a4b”, “alpha”:0.5, “width”:0.04

}, “face”: {

“visible”: false, “color”:”#8aa678”, “alpha”: 1.0, “zorder”: -1

}, “axis”: {

“autoscale”: true, “color_bar”: false, “color_bar_cmap”:”viridis”, “color_bar_range”:false, “color_bar_label”:false, “color_bar_target”:”face”

}

}

Note

Important note for quantitative colormap plots: make sure to normalize your values before getting the colors using

draw_specs[“face”][“color”] = cmap(pandas_holding_quantity_of_interest)

For each plot normalize with respect to the current values (max and min) such that they lie between and including 0 to 1. Note that if you want to keep a constant colorbar range you have to choose the normalization to match the max and min of the color bar range you chose.

Module contents#

tyssue.draw.highlight_cells(eptm, cells, reset_visible=False)[source]#

Sets a column ‘visible’ to True for all the faces of the cells passed as argument (for a 3D tyssue).

If no such column exists in eptm.face_df, creates it.

tyssue.draw.highlight_faces(face_df, faces, reset_visible=False)[source]#

Sets the faces visibility to 1

If reset_visible is True, sets all the other faces to visible = False

tyssue.draw.sheet_view(sheet, coords=['x', 'y', 'z'], ax=None, mode='2D', **draw_specs_kw)[source]#

Main plotting function in 2D or 3D.

Parameters
  • sheet (Epithelium instance) –

  • coords (list of strings,) – the coordinates over which to do the plot

  • ax (:class:matplotlib.Axes instance, default None) – axis over which to plot the sheet, for quick and

  • mode (str, {'2D'|'quick'|'3D'|'vispy'}, default '2D') – the type of graph to plot (see bellow)

Return type

fig, {ax|meshes}