msticpy.vis.matrix_plot module

Bokeh matrix plot.

class msticpy.vis.matrix_plot.PlotParams(title: str | None = 'Interaction Plot', x: str | None = None, x_col: str | None = None, y: str | None = None, y_col: str | None = None, intersect: bool = False, height: int = 700, width: int = 900, color: str = 'red', value_col: str | None = None, dist_count: bool = False, log_size: bool = False, invert: bool = False, sort: str | bool | None = None, sort_x: str | bool | None = None, sort_y: str | bool | None = None, hide: bool = False, font_size: int | None = None, max_label_font_size: int = 11)

Bases: object

Plot params for time_duration.

Method generated by attrs for class PlotParams.

color: str
dist_count: bool
classmethod field_list() List[str]

Return field names as a list.

font_size: int | None
height: int
hide: bool
intersect: bool
invert: bool
log_size: bool
max_label_font_size: int
sort: str | bool | None
sort_x: str | bool | None
sort_y: str | bool | None
title: str | None
value_col: str | None
width: int
x: str | None
x_col: str | None
property x_column: str | None

Return the current x column value.

y: str | None
y_col: str | None
property y_column: str | None

Return the current y column value.

msticpy.vis.matrix_plot.plot_matrix(data: DataFrame, **kwargs) bokeh.models.LayoutDOM

Plot data as an intersection matrix.

Parameters:
  • data (pd.DataFrame) – The data to plot.

  • x (str) – Column to plot on the x (horizontal) axis

  • x_col (str) – Alias for ‘x’

  • y (str) – Column to plot on the y (vertical) axis

  • y_col (str) – Alias for ‘y’

  • title (str, optional) – Custom title, default is ‘Intersection plot’

  • value_col (str, optional) – Column from the DataFrame used to size the intersection points.

  • dist_count (bool, optional) – Calculates a count of distinct values (from value_col) and uses this to size the intersection points. Requires value_col to be specified.

  • log_size (bool, optional) – Takes the log of the size value before calculating the intersection display point size. Can be combined with invert.

  • invert (bool, optional) – Takes the inverse of the size value as the basis for calculating the intersection display point size. This is useful for highlighting rare interactions. Can be combined with log_size.

  • intersect (bool, optional) – Plots points of a fixed size, rather than using a sizing value. This is useful for just showing the presence/absence of an interaction.

  • height (int, optional) – The plot height. Default is 700

  • width (int) – The plot width. Default is 900

  • color (str) – The color of the plotted points, default is “red”

  • sort (Union[str, bool], optional) – Sorts the labels of both axes, default is None. Acceptable values are: ‘asc’ (or string starting with ‘asc’) - Sort ascending ‘desc’ (or string starting with ‘asc’) - Sort descending False or None (no sort) True - Sort ascending

  • sort_x (str, optional) – Sorts the labels of the x axis (takes precedence over sort), default is None. Acceptable values are: ‘asc’ (or string starting with ‘asc’) - Sort ascending ‘desc’ (or string starting with ‘asc’) - Sort descending False or None (no sort) True - Sort ascending

  • sort_y (str, optional) – Sorts the labels of the y axis (takes precedence over sort), default is None. Acceptable values are: ‘asc’ (or string starting with ‘asc’) - Sort ascending ‘desc’ (or string starting with ‘asc’) - Sort descending False or None (no sort) True - Sort ascending

  • hide (bool, optional) – Creates and returns but does not display the plot, default is False.

  • font_size (int, optional) – Manually specify the font size for axis labels, in points, the default is to automatically calculate a size based on the number of items in each axis.

  • max_label_font_size (int, optional) – The maximum size, in points, of the X and Y labels, default is 11.

Returns:

The Bokeh plot

Return type:

LayoutDOM