CellModules
pythonlib.visualization Namespace Reference

Functions

None drawCellLineage ('Dict[str, Any]' data, str cell_attribute, bool use_plotly=False, str color_scale='Spectral_r', Optional[Dict[Any, str]] discrete_colors=None)
 

Function Documentation

◆ drawCellLineage()

None pythonlib.visualization.drawCellLineage ( 'Dict[str, Any]'  data,
str  cell_attribute,
bool   use_plotly = False,
str   color_scale = 'Spectral_r',
Optional[Dict[Any, str]]   discrete_colors = None 
)
Draws the lineage of cells in the simulation based on a specified cell attribute.

Parameters
----------
- data : dict
    The dictionary containing cell lineage data and enumeration map. It should have the keys 'data' and 'enumMap'.
- cell_attribute : str
    The name of the cell attribute to visualize. This can be a discrete or continuous attribute.
- use_plotly : bool, optional
    If True, use Plotly for visualization. If False, use Matplotlib. Default is False.
- color_scale : str, optional
    The color scale to use for visualization. Default is 'Spectral_r'.
- discrete_colors : dict, optional
    A dictionary mapping discrete attribute values to specific colors. If provided, this will be used for coloring discrete attributes.

Returns
-------
- None
    This function does not return any value. It generates and displays a lineage plot.

Example
-------
```python
simu = Simu(params)
lineage_data = simu.recordLineage()
discrete_colors = {'A': '#1f77b4', 'B': '#ff7f0e', 'C': '#2ca02c'}
drawCellLineage(lineage_data, 'state', use_plotly=True, color_scale='Viridis', discrete_colors=discrete_colors)
```

Notes
-----
- If the `cell_attribute` is an Enum, the corresponding values are replaced and the data type is set to 'category'.
- For continuous attributes, a color map is used to represent the range of values.

Definition at line 8 of file visualization.py.