fcapy.visualizer.POSetVisualizer

class fcapy.visualizer.POSetVisualizer(poset: Optional[POSet] = None, node_color='lightgray', edge_color='lightgray', node_edgecolor='white', cmap='Blues', node_alpha=1, node_size=300, node_linewidth=1, cmap_min=None, cmap_max=None, label_font_size=12)

A class to visualize POSet as graph .. method:: draw_networkx(…):

Draw a ConceptLattice line diagram with networkx package

get_plotly_figure(...):

Return a Plotly figure with the ConceptLattice line diagram

__init__(poset: Optional[POSet] = None, node_color='lightgray', edge_color='lightgray', node_edgecolor='white', cmap='Blues', node_alpha=1, node_size=300, node_linewidth=1, cmap_min=None, cmap_max=None, label_font_size=12)

Initialize the Visualizer :param poset: A Partially Ordered Set to visualize :type poset: POSet :param node_color: A default color to use for ConceptLattice visualization (can be changed afterwards) :type node_color: str or list of str :param cmap: Colormap to use for ConceptLattice visualization :type cmap: str :param node_alpha: Transparency of nodes :type node_alpha: float :param node_linewidth: Width of borderline (edge) around the nodes in a line diagram :type node_linewidth: float :param node_edgecolor: Color of borderline (edge) around the nodes in a line diagram :type node_edgecolor: float :param cmap_min: The minimum value of a colormap :type cmap_min: float :param cmap_max: The maximum value of a colormap :type cmap_max: float :param label_font_size: The size of a font size when labeling the nodes :type label_font_size: int

Methods

__init__([poset, node_color, edge_color, ...])

Initialize the Visualizer :param poset: A Partially Ordered Set to visualize :type poset: POSet :param node_color: A default color to use for ConceptLattice visualization (can be changed afterwards) :type node_color: str or list of str :param cmap: Colormap to use for ConceptLattice visualization :type cmap: str :param node_alpha: Transparency of nodes :type node_alpha: float :param node_linewidth: Width of borderline (edge) around the nodes in a line diagram :type node_linewidth: float :param node_edgecolor: Color of borderline (edge) around the nodes in a line diagram :type node_edgecolor: float :param cmap_min: The minimum value of a colormap :type cmap_min: float :param cmap_max: The maximum value of a colormap :type cmap_max: float :param label_font_size: The size of a font size when labeling the nodes :type label_font_size: int

draw_networkx([draw_node_indices, ...])

Draw line diagram of the POSet with networkx package

draw_plotly([label_func, nodelist])

Get a line diagram of POSet constructed by plotly package :param label_func: A function to create a label for a given element defined by an index :type label_func: 'int' -> 'str' :param nodelist: Indexes of poset elements to draw. :type nodelist: list`[`int] :param kwargs: colorbar_title: str A title of colorbar axis max_new_extent_count: int A number of new objects in concept extent to draw max_new_intent_count: int A number of new objects in concept extent to draw xlim: tuple of `float A tuple of xaxis ranges (x_left, x_right) (default value is (-1, 1)) figsize: tuple of float A tuple of size of a figure (width, height) (default value is (1000, 500)).

get_nodes_position(poset[, layout])

Return a dict of nodes positions in a line diagram

draw_networkx(draw_node_indices=False, edge_radius=None, label_func=None, ax=None, nodelist: Optional[list] = None)

Draw line diagram of the POSet with networkx package

Parameters
  • draw_node_indices (bool) – A flag whether to draw indexes of nodes inside the nodes

  • edge_radius (float) – A value of how much curve the edges on line diagram should be

  • label_func (int -> str) – A function to create a label for a given element defined by an index

  • ax (Matplotlib Axes) – A matplotlib axis to draw a poset on

  • nodelist (list`[`int]) – Indexes of poset elements to draw.

draw_plotly(label_func=None, nodelist: Optional[list] = None, **kwargs)

Get a line diagram of POSet constructed by plotly package :param label_func: A function to create a label for a given element defined by an index :type label_func: ‘int’ -> ‘str’ :param nodelist: Indexes of poset elements to draw. :type nodelist: list`[`int] :param kwargs:

colorbar_title: str

A title of colorbar axis

max_new_extent_count: int

A number of new objects in concept extent to draw

max_new_intent_count: int

A number of new objects in concept extent to draw

xlim: tuple of `float

A tuple of xaxis ranges (x_left, x_right) (default value is (-1, 1))

figsize: tuple of float

A tuple of size of a figure (width, height) (default value is (1000, 500))

Returns

fig – A line diagram of POSet in the form of Plotly FigureWidget

Return type

plotly.graph_objects.FigureWidget

static get_nodes_position(poset, layout='fcart', **kwargs)

Return a dict of nodes positions in a line diagram