evomap.printer#

Functions to draw maps.

Module Contents#

Functions#

format_tick_labels(x, pos)

init_params([custom_params])

Set default aesthetic styles here.

style_axes(ax, show_axes, show_box, show_grid, ...)

Style the axes of a map.

draw_map(X[, label, color, size, inclusions, ...])

draw_shepard_diagram(X, D[, ax, show_grid, ...])

Draw a shepard diagram of input dissimilarities vs map distances.

draw_map_sequence(X_t[, color_t, incl_t, n_cols, ...])

Draw a sequence of static maps next to each other. Can use the same

fit_attribute(coords, attribute_label, ...)

Fit an attribute to the map and display the resultant vector.

fit_attributes(map_coords, df_attributes, map)

Fit multiple attributes and display their vectors in the map.

draw_dynamic_map(X_t[, color_t, size_t, incl_t, ...])

draw_trajectories(Y_ts, labels[, selected_labels, ...])

Draw the trajectories of selected objects.

Attributes#

DEFAULT_BUBBLE_SIZE

DEFAULT_FONT_SIZE

title_fontdict_large

title_fontdict

text_fontdict

axis_label_fontdict

evomap.printer.DEFAULT_BUBBLE_SIZE = 25#
evomap.printer.DEFAULT_FONT_SIZE = 10#
evomap.printer.title_fontdict_large#
evomap.printer.title_fontdict#
evomap.printer.text_fontdict#
evomap.printer.axis_label_fontdict#
evomap.printer.format_tick_labels(x, pos)[source]#
evomap.printer.init_params(custom_params=None)[source]#

Set default aesthetic styles here.

evomap.printer.style_axes(ax, show_axes, show_box, show_grid, axes_at_origin)[source]#

Style the axes of a map.

evomap.printer.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)[source]#
evomap.printer.draw_shepard_diagram(X, D, ax=None, show_grid=False, show_rank_correlation=True)[source]#

Draw a shepard diagram of input dissimilarities vs map distances.

Parameters
  • X (np.ndarray of shape (n_samples, n_dims)) – configuration of objects on the map

  • D (np.ndarray of shape (n_samples, n_samples)) – Dissimilarity matrix

  • ax (Axes, optional) – Axes to draw the shepard diagram on, by default None

  • show_grid (bool, optional) – If true, grid lines will be drawn, by default False

  • show_rank_correlation (bool, optional) – If true, the Spearman rank correlation coefficient will be displayed below the plot, by default True

evomap.printer.draw_map_sequence(X_t, color_t=None, incl_t=None, n_cols=4, time_labels=[], show_axes=False, **kwargs)[source]#

Draw a sequence of static maps next to each other. Can use the same arguments as the ‘draw_map’ function as dictionary.

Parameters
  • Y_ts (list of ndarrays, each of shape (n_samples, d)) – Sequence of map coordinates.

  • c_ts (list of ndarray, each of shape (n_samples,), optional) – 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.

  • n_cols (int, optional) – Max. number of maps shown in one row, by default 4

  • map_kws (dict, optional) – Additional arguments for the ‘draw_map’ function, by default None

  • time_labels (list of str, optional) – When given, use these labels as title strings

evomap.printer.fit_attribute(coords, attribute_label, attribute_values, map)[source]#

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.

Parameters
  • coords (ndarray of shape (n_samples, n_dims)) – Map coordinates.

  • attribute_label (string) – Attribute label (displayed next to vector).

  • attribute_values (ndarray of shape (n_samples,)) – Attribute values for each sample.

  • map (matplotlib.figure) – Figure containing the map (i.e., output of draw_map function)

Returns

Figure containing the map with property vector added.

Return type

matplotlib.figure

evomap.printer.fit_attributes(map_coords, df_attributes, map)[source]#

Fit multiple attributes and display their vectors in the map.

Parameters
  • map_coords (ndarray of shape (n_samples, n_dims)) – Map coordinates.

  • df_attributes (pd.DataFrame) – 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.

  • map (matplotlib.figure) – Figure containing the map (i.e., output of draw_map function)

Returns

Figure containing the map with property vectors added.

Return type

matplotlib.figure

evomap.printer.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)[source]#
evomap.printer.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)[source]#

Draw the trajectories of selected objects.

Parameters
  • Y_ts (list of ndarrays, each of shape (n_samples, d)) – Sequence of map coordinates.

  • labels (ndarray of shape (n_samples,)) – Object labels (str)

  • selected_labels (ndarray of shape (n_selected,), optional) – Selected object labels (str), by default None

  • title (str, optional) – Figure title, by default None

  • annotate_periods (bool, optional) – If true, labels for each period are shown next to each pair of map coordinates, by default True

  • period_labels (ndarray of shape (n_periods,), optional) – Period labels (str), by default None

  • ax (matplotlib.axes.Axes, optional) – Pre-existing axes for the plot, by default None

  • figsize (tuple, optional) – Figure size, by default (12,12)