:py:mod:`evomap.printer` ======================== .. py:module:: evomap.printer .. autoapi-nested-parse:: Functions to draw maps. Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: evomap.printer.format_tick_labels evomap.printer.init_params evomap.printer.style_axes evomap.printer.draw_map evomap.printer.draw_shepard_diagram evomap.printer.draw_map_sequence evomap.printer.fit_attribute evomap.printer.fit_attributes evomap.printer.draw_dynamic_map evomap.printer.draw_trajectories Attributes ~~~~~~~~~~ .. autoapisummary:: evomap.printer.DEFAULT_BUBBLE_SIZE evomap.printer.DEFAULT_FONT_SIZE evomap.printer.title_fontdict_large evomap.printer.title_fontdict evomap.printer.text_fontdict evomap.printer.axis_label_fontdict .. py:data:: DEFAULT_BUBBLE_SIZE :value: 25 .. py:data:: DEFAULT_FONT_SIZE :value: 10 .. py:data:: title_fontdict_large .. py:data:: title_fontdict .. py:data:: text_fontdict .. py:data:: axis_label_fontdict .. py:function:: format_tick_labels(x, pos) .. py:function:: init_params(custom_params=None) Set default aesthetic styles here. .. py:function:: style_axes(ax, show_axes, show_box, show_grid, axes_at_origin) Style the axes of a map. .. py:function:: draw_map(X, label=None, color=None, size=None, inclusions=None, zoom_on_cluster=None, highlighted_labels=None, show_box=True, show_grid=False, show_axes=False, axes_at_origin=False, show_legend=False, cmap=None, filename=None, ax=None, fig_size=None, title=None, rotate_labels=0, scatter_kws={}, fontdict=None, rcparams=None) .. py:function:: draw_shepard_diagram(X, D, ax=None, show_grid=False, show_rank_correlation=True) Draw a shepard diagram of input dissimilarities vs map distances. :param X: configuration of objects on the map :type X: np.ndarray of shape (n_samples, n_dims) :param D: Dissimilarity matrix :type D: np.ndarray of shape (n_samples, n_samples) :param ax: Axes to draw the shepard diagram on, by default None :type ax: Axes, optional :param show_grid: If true, grid lines will be drawn, by default False :type show_grid: bool, optional :param show_rank_correlation: If true, the Spearman rank correlation coefficient will be displayed below the plot, by default True :type show_rank_correlation: bool, optional .. py:function:: draw_map_sequence(X_t, color_t=None, incl_t=None, n_cols=4, time_labels=[], show_axes=False, **kwargs) Draw a sequence of static maps next to each other. Can use the same arguments as the 'draw_map' function as dictionary. :param Y_ts: Sequence of map coordinates. :type Y_ts: list of ndarrays, each of shape (n_samples, d) :param c_ts: Sequence of cluster assignments used for coloring (int), by default None If the cluster assignments are constant, one can simply provide a single array as kwarg. :type c_ts: list of ndarray, each of shape (n_samples,), optional :param n_cols: Max. number of maps shown in one row, by default 4 :type n_cols: int, optional :param map_kws: Additional arguments for the 'draw_map' function, by default None :type map_kws: dict, optional :param time_labels: When given, use these labels as title strings :type time_labels: list of str, optional .. py:function:: fit_attribute(coords, attribute_label, attribute_values, map) Fit an attribute to the map and display the resultant vector. To do so, regress the attribute value on map coordinates and use the coefficients as arrow coordinates. :param coords: Map coordinates. :type coords: ndarray of shape (n_samples, n_dims) :param attribute_label: Attribute label (displayed next to vector). :type attribute_label: string :param attribute_values: Attribute values for each sample. :type attribute_values: ndarray of shape (n_samples,) :param map: Figure containing the map (i.e., output of draw_map function) :type map: matplotlib.figure :returns: Figure containing the map with property vector added. :rtype: matplotlib.figure .. py:function:: fit_attributes(map_coords, df_attributes, map) Fit multiple attributes and display their vectors in the map. :param map_coords: Map coordinates. :type map_coords: ndarray of shape (n_samples, n_dims) :param df_attributes: Dataframe containing the attributes. Each column is expected to correspond to one attribute. Make sure to label colums and that the number of rows equals n_samples. :type df_attributes: pd.DataFrame :param map: Figure containing the map (i.e., output of draw_map function) :type map: matplotlib.figure :returns: Figure containing the map with property vectors added. :rtype: matplotlib.figure .. py:function:: draw_dynamic_map(X_t, color_t=None, size_t=None, incl_t=None, show_arrows=False, show_last_positions_only=False, time_labels=None, transparency_start=0.1, transparency_end=0.4, transparency_final=1.0, **kwargs) .. py:function:: draw_trajectories(Y_ts, labels, selected_labels=None, title=None, show_axes=False, show_box=True, show_grid=False, axes_at_origin=False, annotate_periods=True, period_labels=None, ax=None, fig_size=None) Draw the trajectories of selected objects. :param Y_ts: Sequence of map coordinates. :type Y_ts: list of ndarrays, each of shape (n_samples, d) :param labels: Object labels (str) :type labels: ndarray of shape (n_samples,) :param selected_labels: Selected object labels (str), by default None :type selected_labels: ndarray of shape (n_selected,), optional :param title: Figure title, by default None :type title: str, optional :param annotate_periods: If true, labels for each period are shown next to each pair of map coordinates, by default True :type annotate_periods: bool, optional :param period_labels: Period labels (str), by default None :type period_labels: ndarray of shape (n_periods,), optional :param ax: Pre-existing axes for the plot, by default None :type ax: matplotlib.axes.Axes, optional :param figsize: Figure size, by default (12,12) :type figsize: tuple, optional