leaspy.io.logs.visualization.plotting ===================================== .. py:module:: leaspy.io.logs.visualization.plotting Classes ------- .. autoapisummary:: leaspy.io.logs.visualization.plotting.Plotting Module Contents --------------- .. py:class:: Plotting(model, output_path='.', palette='tab10', max_colors=10) .. deprecated:: 1.2 Class defining some plotting tools. :Parameters: **model** : :class:`~leaspy.models.BaseModel` The used model. **output_path** : :obj:`str`, (optional) Folder where plots will be saved. If None, default to current working directory. **palette** : :obj:`str` (palette name) or :class:`matplotlib.colors.Colormap` (`ListedColormap` or `LinearSegmentedColormap`) The palette to use. **max_colors** : :obj:`int` > 0, optional (default, corresponding to model nb of features) Only used if palette is a string .. !! processed by numpydoc !! .. py:attribute:: model .. py:attribute:: color_palette :value: None .. py:attribute:: standard_size :value: (8, 4) .. py:attribute:: linestyle .. py:attribute:: linewidth .. py:attribute:: alpha .. py:attribute:: output_path :value: '.' .. py:method:: set_palette(palette, max_colors=None) Set palette of plots :Parameters: **palette** : :obj:`str` (palette name) or :class:`matplotlib.colors.Colormap` (`ListedColormap` or `LinearSegmentedColormap`) The palette to use. **max_colors** : :obj:`int` > 0, optional (default, corresponding to model nb of features) Only used if palette is a string .. !! processed by numpydoc !! .. py:method:: colors(at=None) Wrapper over color_palette iterator to get colors :Parameters: **at** : any legit color_palette arg (int, float or iterable of any of these) or None (default) if None returns all colors of palette upto model dimension :Returns: **colors** : single color tuple (RGBA) or np.array of RGBA colors (number of colors x 4) .. .. !! processed by numpydoc !! .. py:method:: average_trajectory(**kwargs) Plot the population average trajectories. They are parametrized by the population parameters derived during the calibration. :Parameters: **\*\*kwargs** * alpha: :obj:`float`, default 0.6 Matplotlib's transparency option. Must be in [0, 1]. * linestyle: {'-', '--', '-.', ':', '', (offset, on-off-seq), ...} Matplotlib's linestyle option. * linewidth: :obj:`float` Matplotlib's linewidth option. * features: list[:obj:`str`] Name of features (if set it must be a subset of model features) Default: all model features. * colors: list[:obj:`str`] Contains matplotlib compatible colors. At least as many as number of features. * labels: list[:obj:`str`] Used to rename features in the plot. Exactly as many as number of features. Default: raw variable name of each feature * ax: matplotlib.axes.Axes Axes object to modify, instead of creating a new one. * figsize: tuple of int The figure's size. * save_as: :obj:`str`, default None Path to save the figure. * title: :obj:`str` * n_tpts: :obj:`int` Number of timepoints in plot (default: 100) * n_std_left, n_std_right: :obj:`float` (default: 3 and 6 resp.) Time window around `tau_mean`, expressed as times of max(`tau_std`, 4) :Returns: :class:`matplotlib.axes.Axes` .. .. !! processed by numpydoc !! .. py:method:: patient_observations(data, patients_idx='all', individual_parameters=None, **kwargs) Plot patient observations :Parameters: **data** : :class:`.Data` .. **patients_idx** : 'all' (default), :obj:`str` or list[:obj:`str`] Patients to display (by their ID). **individual_parameters** : :class:`.IndividualParameters` or :class:`pandas.DataFrame` (as may be output by ip.to_dataframe()) or dict (Pytorch ip format), optional If not None, observations are plotted with respect to reparametrized ages. .. !! processed by numpydoc !! .. py:method:: patient_observations_reparametrized(data, individual_parameters, patients_idx='all', **kwargs) Plot patient observations (reparametrized ages) .. !! processed by numpydoc !! .. py:method:: patient_trajectories(data, individual_parameters, patients_idx='all', reparametrized_ages=False, **kwargs) Plot patient observations together with model individual reconstruction :Parameters: **data** : :class:`.Data` .. **individual_parameters** : :class:`.IndividualParameters` or :class:`pandas.DataFrame` (as may be output by ip.to_dataframe()) or dict (Pytorch ip format) .. **patients_idx** : 'all' (default), :obj:`str` or list[:obj:`str`] Patients to display (by their ID). **reparametrized_ages** : :obj:`bool` (default False) Should we plot trajectories in reparam age or not? to study source impact essentially **\*\*kwargs** cf. :meth:`._plot_model_trajectories` In particular, pass marker=None if you don't want observations besides model .. !! processed by numpydoc !!