Visualization

tmplot.plot_scatter_topics(topics_coords: ndarray | DataFrame, x_col: str = 'x', y_col: str = 'y', topic: int = None, size_col: str = None, label_col: str = None, color_col: str = None, topic_col: str = None, font_size: int = 13, x_kws: dict = None, y_kws: dict = None, chart_kws: dict = None, circle_kws: dict = None, circle_enc_kws: dict = None, text_kws: dict = None, text_enc_kws: dict = None, size_kws: dict = None, color_kws: dict = None) Chart

Topics scatter plot in 2D.

Parameters:
  • topics_coords (Union[ndarray, DataFrame]) – Topics scatter coordinates.

  • x_col (str, optional) – X column name.

  • y_col (str, optional) – Y column name.

  • topic (int, optional) – Topic index.

  • size_col (str, optional) – Column with size values.

  • label_col (str, optional) – Column with topic labels.

  • color_col (str, optional) – Column with colors.

  • topic_col (str, optional) – Column with topics texts.

  • font_size (int, optional) – Font size.

  • x_kws (dict, optional) – Keyword arguments passed to altair.X().

  • y_kws (dict, optional) – Keyword arguments passed to altair.Y().

  • chart_kws (dict, optional) – Keyword arguments passed to altair.Chart().

  • circle_kws (dict, optional) – Keyword arguments passed to altair.Chart.mark_circle().

  • circle_enc_kws (dict, optional) – Keyword arguments passed to altair.Chart.encode() for circle elements.

  • text_kws (dict, optional) – Keyword arguments passed to altair.Chart.mark_text().

  • text_enc_kws (dict, optional) – Keyword arguments passed to altair.Chart.encode() for text elements.

  • size_kws (dict, optional) – Keyword arguments passed to altair.Size() for circle elements.

  • color_kws (dict, optional) – Keyword arguments passed to altair.Color() for circle elements.

Returns:

Topics scatter plot.

Return type:

altair.Chart

tmplot.plot_terms(terms_probs: DataFrame, x_col: str = 'Probability', y_col: str = 'Terms', color_col: str = 'Type', font_size: int = 13, chart_kws: dict = None, bar_kws: dict = None, x_kws: dict = None, y_kws: dict = None, color_kws: dict = None) Chart

Plot words conditional and marginal probabilities.

Parameters:
  • terms_probs (DataFrame) – Words probabilities.

  • x_col (str, optional) – X column name.

  • y_col (str, optional) – Y column name.

  • color_col (str, optional) – Column with values types (for coloring).

  • font_size (int, optional) – Font size.

  • chart_kws (dict, optional) – Keyword arguments passed to altair.Chart().

  • bar_kws (dict, optional) – Keyword arguments passed to altair.Chart.mark_bar().

  • x_kws (dict, optional) – Keyword arguments passed to altair.X().

  • y_kws (dict, optional) – Keyword arguments passed to altair.Y().

  • color_kws (dict, optional) – Keyword arguments passed to altair.Color().

Returns:

Terms probabilities chart.

Return type:

altair.Chart

tmplot.plot_docs(docs: Sequence[str] | DataFrame, styles: str = None, html_kws: dict = None) DataFrame

Documents plotting functionality for report interface.

Parameters:
  • docs (Union[Sequence[str], DataFrame]) – Documents.

  • styles (str, optional) – Styles string for formatting the table with documents. Concatenated with HTML.

  • html_kws (dict, optional) – Keyword arguments passed to pandas.DataFrame.to_html() method.

Returns:

Topic documents.

Return type:

ipywidgets.HTML