topologicpy.Plotly module

class topologicpy.Plotly.Plotly

Bases: object

Methods

AddColorBar(figure[, values, nTicks, ...])

Adds a color bar to the input figure

Colors()

Returns the list of named CSS colors that plotly can use.

DataByGraph(graph[, sagitta, absolute, ...])

Creates plotly vertex and edge data from the input graph.

DataByTopology(topology[, showVertices, ...])

Creates plotly face, edge, and vertex data.

ExportToImage(figure, path[, format, width, ...])

Exports the plotly figure to an image.

FigureByConfusionMatrix(matrix[, ...])

Returns a Plotly Figure of the input confusion matrix.

FigureByCorrelation(actual, predicted[, ...])

Returns a Plotly Figure showing the correlation between the input actual and predicted values.

FigureByData(data[, width, height, xAxis, ...])

Creates a plotly figure.

FigureByDataFrame(dataFrame[, labels, ...])

Returns a Plotly Figure of the input dataframe

FigureByJSONFile(file)

Imports a plotly figure from a JSON file.

FigureByJSONPath(path)

Imports a plotly figure from a JSON file path.

FigureByMatrix(matrix[, xCategories, ...])

Returns a Plotly Figure of the input matrix.

FigureByPieChart(data, values, names)

Creates a plotly pie chart figure.

FigureByTopology(topology[, showVertices, ...])

Creates a figure from the input topology.

FigureExportToJSON(figure, path[, overwrite])

Exports the input plotly figure to a JSON file.

FigureExportToPDF(figure, path[, width, ...])

Exports the input plotly figure to a PDF file.

FigureExportToPNG(figure, path[, width, ...])

Exports the input plotly figure to a PNG file.

FigureExportToSVG(figure, path[, width, ...])

Exports the input plotly figure to a SVG file.

Renderer()

Return the renderer most suitable for the environment in which the script is running.

Renderers()

Returns a list of the available plotly renderers.

SetCamera(figure[, camera, center, up, ...])

Sets the camera for the input figure.

Show(figure[, camera, center, up, renderer, ...])

Shows the input figure.

ColorScale

edgeData

vertexData

static AddColorBar(figure, values=[], nTicks=5, xPosition=-0.15, width=15, outlineWidth=0, title='', subTitle='', units='', colorScale='viridis', mantissa: int = 6)

Adds a color bar to the input figure

Parameters
figureplotly.graph_objs._figure.Figure

The input plotly figure.

valueslist , optional

The input list of values to use for the color bar. Default is [].

nTicksint , optional

The number of ticks to use on the color bar. Default is 5.

xPositionfloat , optional

The x location of the color bar. Default is -0.15.

widthint , optional

The width in pixels of the color bar. Default is 15

outlineWidthint , optional

The width in pixels of the outline of the color bar. Default is 0.

titlestr , optional

The title of the color bar. Default is “”.

subTitlestr , optional

The subtitle of the color bar. Default is “”.

units: str , optional

The units used in the color bar. Default is “”

colorScalestr , optional

The desired type of plotly color scales to use (e.g. “viridis”, “plasma”). Default is “viridis”. For a full list of names, see https://plotly.com/python/builtin-colorscales/. In addition to these, three color-blind friendly scales are included. These are “protanopia”, “deuteranopia”, and “tritanopia” for red, green, and blue colorblindness respectively.

mantissaint , optional

The desired length of the mantissa for the values listed on the color bar. Default is 6.

Returns
——-
plotly.graph_objs._figure.Figure

The input figure with the color bar added.

static ColorScale(colorScale: str = 'viridis')
static Colors()

Returns the list of named CSS colors that plotly can use.

Returns
list

The list of named CSS colors.

static DataByGraph(graph, sagitta: float = 0, absolute: bool = False, sides: int = 8, angle: float = 0, directed: bool = False, arrowSize: int = 0.1, arrowSizeKey: str = None, vertexColor: str = 'black', vertexColorKey: str = None, vertexSize: float = 10, vertexSizeKey: str = None, vertexLabelKey: str = None, vertexBorderColor: str = 'black', vertexBorderWidth: float = 0, vertexBorderColorKey: str = None, vertexBorderWidthKey: float = None, vertexGroupKey: str = None, vertexGroups: list = [], vertexMinGroup=None, vertexMaxGroup=None, showVertices: bool = True, showVertexLabel: bool = False, vertexLabelFontSize: int = 5, showVertexLegend: bool = False, vertexLegendLabel='Graph Vertices', vertexLegendRank=4, vertexLegendGroup=4, edgeColor: str = 'red', edgeColorKey: str = None, edgeWidth: float = 1, edgeWidthKey: str = None, edgeDash: bool = False, edgeDashKey: str = None, edgeLabelKey: str = None, edgeGroupKey: str = None, edgeGroups: list = [], edgeMinGroup=None, edgeMaxGroup=None, showEdges: bool = True, showEdgeLabel: bool = False, showEdgeLegend: bool = False, edgeLegendLabel='Graph Edges', edgeLegendRank=5, edgeLegendGroup=5, colorScale: str = 'viridis', mantissa: int = 6, silent: bool = False)

Creates plotly vertex and edge data from the input graph.

Parameters
graphtopologic_core.Graph

The input graph.

sagittafloat , optional

The length of the sagitta. In mathematics, the sagitta is the line connecting the center of a chord to the apex (or highest point) of the arc subtended by that chord. Default is 0 which means a straight edge is drawn instead of an arc. Default is 0.

absolutebool , optional

If set to True, the sagitta length is treated as an absolute value. Otherwise, it is treated as a ratio based on the length of the edge. Default is False. For example, if the length of the edge is 10, the sagitta is set to 0.5, and absolute is set to False, the sagitta length will be 5. Default is True.

sidesint , optional

The number of sides of the arc. Default is 8.

directedbool , optional

If set to True, arrowheads are drawn to show direction. Default is False.

arrowSizeint, optional

The desired size of arrowheads for directed graphs. Default is 0.1.

arrowSizeKey: str , optional

The edge dictionary key under which to find the arrowhead size. Default is None.

vertexColorstr , optional

The desired color of the output vertices. This can be any plotly color string and may be specified as: - A hex string (e.g. ‘#ff0000’) - An rgb/rgba string (e.g. ‘rgb(255,0,0)’) - An hsl/hsla string (e.g. ‘hsl(0,100%,50%)’) - An hsv/hsva string (e.g. ‘hsv(0,100%,100%)’) - A named CSS color. The default is “black”.

vertexColorKeystr , optional

The dictionary key under which to find the vertex color. Default is None.

vertexSizefloat , optional

The desired size of the vertices. Default is 6.

vertexLabelKeystr , optional

The dictionary key to use to display the vertex label. Default is None.

vertexGroupKeystr , optional

The dictionary key to use to display the vertex group. Default is None.

vertexGroupslist , optional

The list of vertex groups against which to index the color of the vertex. Default is [].

vertexMinGroupint or float , optional

For numeric vertexGroups, vertexMinGroup is the desired minimum value for the scaling of colors. This should match the type of value associated with the vertexGroupKey. If set to None, it is set to the minimum value in vertexGroups. Default is None.

vertexMaxGroupint or float , optional

For numeric vertexGroups, vertexMaxGroup is the desired maximum value for the scaling of colors. This should match the type of value associated with the vertexGroupKey. If set to None, it is set to the maximum value in vertexGroups. Default is None.

showVerticesbool , optional

If set to True the vertices will be drawn. Otherwise, they will not be drawn. Default is True.

showVertexLabelbool , optional

If set to True, the vertex labels are shown permenantely on screen. Otherwise, they are not. Default is False.

showVertexLegendbool , optional

If set to True the vertex legend will be drawn. Otherwise, it will not be drawn. Default is False.

vertexLegendLabelstr , optional

The legend label string used to identify vertices. Default is “Topology Vertices”.

vertexLegendRankint , optional

The legend rank order of the vertices of this topology. Default is 1.

vertexLegendGroupint , optional

The number of the vertex legend group to which the vertices of this topology belong. Default is 1.

edgeColorstr , optional

The desired color of the output edges. This can be any plotly color string and may be specified as: - A hex string (e.g. ‘#ff0000’) - An rgb/rgba string (e.g. ‘rgb(255,0,0)’) - An hsl/hsla string (e.g. ‘hsl(0,100%,50%)’) - An hsv/hsva string (e.g. ‘hsv(0,100%,100%)’) - A named CSS color. The default is “black”.

edgeColorKeystr , optional

The dictionary key under which to find the edge color. Default is None.

edgeWidthfloat , optional

The desired thickness of the output edges. Default is 1.

edgeWidthKeystr , optional

The dictionary key under which to find the edge width. Default is None.

edgeLabelKeystr , optional

The dictionary key to use to display the edge label. Default is None.

edgeDashbool , optional

If set to True, the edges are drawn as dashed lines. Default is False.

edgeDashKeystr , optional

The key under which to find the boolean flag to draw edges as dashed lines. Default is None.

edgeGroupKeystr , optional

The dictionary key to use to display the edge group. Default is None.

edgeGroupslist , optional

The list of groups to use for indexing the color of edges. Default is None.

showEdgesbool , optional

If set to True the edges will be drawn. Otherwise, they will not be drawn. Default is True.

showEdgeLabelsbool , optional

If set to True, the edge labels are shown permenantely on screen. Otherwise, they are not. Default is False.

showEdgeLegendbool , optional

If set to True the edge legend will be drawn. Otherwise, it will not be drawn. Default is False.

colorScalestr , optional

The desired type of plotly color scales to use (e.g. “Viridis”, “Plasma”). Default is “Viridis”. For a full list of names, see https://plotly.com/python/builtin-colorscales/.

silentbool , optional

If set to True, error and warning messages are suppressed. Default is False.

Returns
list

The vertex and edge data list.

static DataByTopology(topology, showVertices=True, vertexSize=2.8, vertexSizeKey=None, vertexColor='black', vertexColorKey=None, vertexLabelKey=None, vertexBorderColor: str = 'black', vertexBorderWidth: float = 0, vertexBorderColorKey: str = None, vertexBorderWidthKey: float = None, showVertexLabel=False, vertexLabelFontSize=5, vertexGroupKey=None, vertexGroups=[], vertexMinGroup=None, vertexMaxGroup=None, showVertexLegend=False, vertexLegendLabel='Topology Vertices', vertexLegendRank=1, vertexLegendGroup=1, directed=False, arrowSize=0.1, arrowSizeKey=None, showEdges=True, edgeWidth=1, edgeWidthKey=None, edgeColor='black', edgeColorKey=None, edgeDash=False, edgeDashKey=None, edgeLabelKey=None, showEdgeLabel=False, edgeGroupKey=None, edgeGroups=[], edgeMinGroup=None, edgeMaxGroup=None, showEdgeLegend=False, edgeLegendLabel='Topology Edges', edgeLegendRank=2, edgeLegendGroup=2, showFaces=True, faceOpacity=0.5, faceOpacityKey=None, faceColor='#FAFAFA', faceColorKey=None, faceLabelKey=None, faceGroupKey=None, faceGroups=[], faceMinGroup=None, faceMaxGroup=None, showFaceLegend=False, faceLegendLabel='Topology Faces', faceLegendRank=3, faceLegendGroup=3, intensityKey=None, intensities=[], material='default', materialKey=None, flatShading=True, ambient=None, ambientKey=None, diffuse=None, diffuseKey=None, specular=None, specularKey=None, roughness=None, roughnessKey=None, colorScale='viridis', mantissa=6, tolerance=0.0001, silent=False)

Creates plotly face, edge, and vertex data.

Parameters
topologytopologic_core.Topology

The input topology. This must contain faces and or edges.

showVerticesbool , optional

If set to True the vertices will be drawn. Otherwise, they will not be drawn. Default is True.

vertexSizefloat , optional

The desired size of the output vertices. Default is 1.1.

vertexSizeKeystr , optional

The dictionary key under which to find the vertex size.The default is None.

vertexColorstr , optional

The desired color of the output vertices. This can be any plotly color string and may be specified as: - A hex string (e.g. ‘#ff0000’) - An rgb/rgba string (e.g. ‘rgb(255,0,0)’) - An hsl/hsla string (e.g. ‘hsl(0,100%,50%)’) - An hsv/hsva string (e.g. ‘hsv(0,100%,100%)’) - A named CSS color. The default is “black”.

vertexColorKeystr , optional

The dictionary key under which to find the vertex color.The default is None.

vertexBorderWidthfloat , optional

The desired width of the border of the output vertices. Default is 0.

vertexBorderColorstr , optional

The desired color of the border of the output vertices. This can be any plotly color string and may be specified as: - A hex string (e.g. ‘#ff0000’) - An rgb/rgba string (e.g. ‘rgb(255,0,0)’) - An hsl/hsla string (e.g. ‘hsl(0,100%,50%)’) - An hsv/hsva string (e.g. ‘hsv(0,100%,100%)’) - A named CSS color. The default is “black”.

vertexLabelKeystr , optional

The dictionary key to use to display the vertex label. Default is None.

vertexLabelFontSizeint , optional

The font size to use for vertex labels. Default is 5.

vertexGroupKeystr , optional

The dictionary key to use to display the vertex group. Default is None.

vertexGroupslist , optional

The list of vertex groups against which to index the color of the vertex. Default is [].

vertexMinGroupint or float , optional

For numeric vertexGroups, vertexMinGroup is the desired minimum value for the scaling of colors. This should match the type of value associated with the vertexGroupKey. If set to None, it is set to the minimum value in vertexGroups. Default is None.

vertexMaxGroupint or float , optional

For numeric vertexGroups, vertexMaxGroup is the desired maximum value for the scaling of colors. This should match the type of value associated with the vertexGroupKey. If set to None, it is set to the maximum value in vertexGroups. Default is None.

showVertexLegendbool, optional

If set to True, the legend for the vertices of this topology is shown. Otherwise, it isn’t. Default is False.

vertexLegendLabelstr , optional

The legend label string used to identify vertices. Default is “Topology Vertices”.

vertexLegendRankint , optional

The legend rank order of the vertices of this topology. Default is 1.

vertexLegendGroupint , optional

The number of the vertex legend group to which the vertices of this topology belong. Default is 1.

directedbool , optional

If set to True, arrowheads are drawn to show direction. Default is False.

arrowSizeint, optional

The desired size of arrowheads for directed graphs. Default is 0.1.

arrowSizeKey: str , optional

The edge dictionary key under which to find the arrowhead size. Default is None.

showEdgesbool , optional

If set to True the edges will be drawn. Otherwise, they will not be drawn. Default is True.

edgeWidthfloat , optional

The desired thickness of the output edges. Default is 1.

edgeWidthKeystr , optional

The dictionary key under which to find the edge width.The default is None.

edgeColorstr , optional

The desired color of the output edges. This can be any plotly color string and may be specified as: - A hex string (e.g. ‘#ff0000’) - An rgb/rgba string (e.g. ‘rgb(255,0,0)’) - An hsl/hsla string (e.g. ‘hsl(0,100%,50%)’) - An hsv/hsva string (e.g. ‘hsv(0,100%,100%)’) - A named CSS color. The default is “black”.

edgeColorKeystr , optional

The dictionary key under which to find the edge color.The default is None.

edgeDashbool , optional

If set to True, the edges are drawn as dashed lines. Default is False.

edgeDashKeystr , optional

The key under which to find the boolean flag to draw edges as dashed lines. Default is None.

edgeLabelKeystr , optional

The dictionary key to use to display the edge label. Default is None.

edgeGroupKeystr , optional

The dictionary key to use to display the edge group. Default is None.

edgeGroupslist , optional

The list of edge groups against which to index the color of the edge. Default is [].

edgeMinGroupint or float , optional

For numeric edgeGroups, edgeMinGroup is the desired minimum value for the scaling of colors. This should match the type of value associated with the edgeGroupKey. If set to None, it is set to the minimum value in edgeGroups. Default is None.

edgeMaxGroupint or float , optional

For numeric edgeGroups, edgeMaxGroup is the desired maximum value for the scaling of colors. This should match the type of value associated with the edgeGroupKey. If set to None, it is set to the maximum value in edgeGroups. Default is None.

showEdgeLegendbool, optional

If set to True, the legend for the edges of this topology is shown. Otherwise, it isn’t. Default is False.

edgeLegendLabelstr , optional

The legend label string used to identify edges. Default is “Topology Edges”.

edgeLegendRankint , optional

The legend rank order of the edges of this topology. Default is 2.

edgeLegendGroupint , optional

The number of the edge legend group to which the edges of this topology belong. Default is 2.

showFacesbool , optional

If set to True the faces will be drawn. Otherwise, they will not be drawn. Default is True.

faceOpacityfloat , optional

The desired opacity of the output faces (0=transparent, 1=opaque). Default is 0.5.

faceOpacityKeystr , optional

The dictionary key under which to find the face opacity.The default is None.

faceColorstr , optional

The desired color of the output faces. This can be any plotly color string and may be specified as: - A hex string (e.g. ‘#ff0000’) - An rgb/rgba string (e.g. ‘rgb(255,0,0)’) - An hsl/hsla string (e.g. ‘hsl(0,100%,50%)’) - An hsv/hsva string (e.g. ‘hsv(0,100%,100%)’) - A named CSS color. The default is “#FAFAFA”.

faceColorKeystr , optional

The dictionary key under which to find the face color.The default is None.

faceLabelKeystr , optional

The dictionary key to use to display the face label. Default is None.

faceGroupKeystr , optional

The dictionary key to use to display the face group. Default is None.

faceGroupslist , optional

The list of face groups against which to index the color of the face. This can bhave numeric or string values. This should match the type of value associated with the faceGroupKey. Default is [].

faceMinGroupint or float , optional

For numeric faceGroups, minGroup is the desired minimum value for the scaling of colors. This should match the type of value associated with the faceGroupKey. If set to None, it is set to the minimum value in faceGroups. Default is None.

faceMaxGroupint or float , optional

For numeric faceGroups, maxGroup is the desired maximum value for the scaling of colors. This should match the type of value associated with the faceGroupKey. If set to None, it is set to the maximum value in faceGroups. Default is None.

showFaceLegendbool, optional

If set to True, the legend for the faces of this topology is shown. Otherwise, it isn’t. Default is False.

faceLegendLabelstr , optional

The legend label string used to idenitfy edges. Default is “Topology Faces”.

faceLegendRankint , optional

The legend rank order of the faces of this topology. Default is 3.

faceLegendGroupint , optional

The number of the face legend group to which the faces of this topology belong. Default is 3.

intensityKeystr, optional

If not None, the dictionary of each vertex is searched for the value associated with the intensity key. This value is then used to color-code the vertex based on the colorScale. Default is None.

intensitieslist , optional

The list of intensities against which to index the intensity of the vertex. Default is [].

materialstr , optional

The type of object material. Supported pre-built materials are: Preset Ambient Diffuse Specular Roughness Description ————————————————————– chalk 1.0 0.4 0.0 1.0 Very soft shading, low contrast concrete 0.85 0.75 0.05 0.9 Highly matte, micro-rough surface, minimal specular reflection eggshell 0.65 0.85 0.25 0.45 Slight sheen, soft highlights without gloss glossy 0.5 0.9 0.6 0.1 Highly polished appearance matte 0.9 0.7 0.0 1.0 Flat, non-reflective surfaces metallic 0.3 0.8 0.9 0.2 Strong, sharp reflections plastic 0.6 0.9 0.2 0.4 Soft highlights, good shape readability default N/A N/A N/A N/A Flat shading is applied. Default is plastic.

materialKeystr , optional

The dictionary key under which the material string is stored. Default is None.

flatShadingbool , optional

If set to True, the model is rendered with flat shading with no clear light source. Default is True.

ambientfloat , optional

Controls the strength of ambient light applied uniformly to the surface. Higher values reduce shading contrast by increasing overall brightness. Typical range is [0, 1]. This over-rides the material pre-sets. Default is 0.6.

ambientKeystr , optional

The dictionary key under which the ambient value (float) is stored. Default is None.

diffusefloat , optional

Controls the strength of diffuse (Lambertian) lighting based on the angle between the light direction and the surface normal. Higher values enhance shape perception through shading. Typical range is [0, 1]. This over-rides the material pre-sets. Default is None.

diffuseKeystr , optional

The dictionary key under which the diffuse value (float) is stored. Default is None.

specularfloat , optional

Controls the intensity of specular (mirror-like) highlights on the surface. Higher values produce sharper and brighter highlights, giving a glossy appearance. Typical range is [0, 1]. This over-rides the material pre-sets. Default is None.

specularKeystr , optional

The dictionary key under which the specular value (float) is stored. Default is None.

roughnessfloat , optional

Controls the spread of specular highlights on the surface. Lower values result in sharp, concentrated highlights (smooth surfaces), while higher values produce broader, softer highlights (rough surfaces). Typical range is [0, 1]. This over-rides the material pre-sets. Default is None.

roughnessKeystr , optional

The dictionary key under which the roughness value (float) is stored. Default is None.

colorScalestr , optional

The desired type of plotly color scales to use (e.g. “Viridis”, “Plasma”). Default is “Viridis”. For a full list of names, see https://plotly.com/python/builtin-colorscales/.

mantissaint , optional

The number of decimal places to round the result to. Default is 6.

tolerancefloat , optional

The desired tolerance. Default is 0.0001.

Returns
list

The vertex, edge, and face data list.

static ExportToImage(figure, path, format='png', width='1920', height='1080')

Exports the plotly figure to an image.

Parameters
figureplotly.graph_objs._figure.Figure

The input plotly figure.

pathstr

The image file path.

formatstr , optional

The desired format. This can be any of “jpg”, “jpeg”, “pdf”, “png”, “svg”, or “webp”. It is case insensitive. Default is “png”.

widthint , optional

The width in pixels of the figure. The default value is 1920.

heightint , optional

The height in pixels of the figure. The default value is 1080.

Returns
bool

True if the image was exported sucessfully. False otherwise.

static FigureByConfusionMatrix(matrix, categories=[], minValue=None, maxValue=None, title='Confusion Matrix', xTitle='Actual Categories', yTitle='Predicted Categories', width=950, height=500, showScale=True, colorScale='viridis', colorSamples=10, backgroundColor='rgba(0,0,0,0)', marginLeft=0, marginRight=0, marginTop=40, marginBottom=0, baseFontSize=16, tickFontSize=14, titleFontSize=22, axisTitleFontSize=16, annotationFontSize=18, grayScale=False)

Returns a Plotly Figure of the input confusion matrix. Actual categories are displayed on the X-Axis, Predicted categories are displayed on the Y-Axis.

Parameters
matrixlist or numpy.array

The matrix to display.

categorieslist

The list of categories to use on the X and Y axes.

minValuefloat , optional

The desired minimum value to use for the color scale. If set to None, the minimum value found in the input matrix will be used.

maxValuefloat , optional

The desired maximum value to use for the color scale. If set to None, the maximum value found in the input matrix will be used.

titlestr , optional

The desired title to display. Default is “Confusion Matrix”.

xTitlestr , optional

The desired X-axis title to display. Default is “Actual Categories”.

yTitlestr , optional

The desired Y-axis title to display. Default is “Predicted Categories”.

widthint , optional

The desired width of the figure. Default is 950.

heightint , optional

The desired height of the figure. Default is 500.

showScalebool , optional

If set to True, a color scale is shown on the right side of the figure. Default is True.

colorScalestr , optional

The desired type of plotly color scales to use (e.g. “Viridis”, “Plasma”). Default is “Viridis”.

colorSamplesint , optional

The number of discrete color samples to use for displaying the data. Default is 10.

backgroundColorlist or str , optional

The desired background color (see docstring above). Default is transparent.

marginLeft, marginRight, marginTop, marginBottomint , optional

Plot margins in pixels.

baseFontSizeint , optional

The base font size. Default is 16.

tickFontSizeint , optional

The tick font size. Default is 14.

titleFontSizeint , optional

The title font size. Default is 22.

axisTitleFontSizeint , optional

The axis title font size. Default is 16.

annotationFontSizeint , optional

The annotation font size. Default is 18.

grayScalebool , optional

If set to True, the figure is rendered in grayscale. Default is False.

Returns
plotly.graph_objects.Figure

The created plotly figure.

static FigureByCorrelation(actual, predicted, title='Correlation between Actual and Predicted Values', xTitle='Actual Values', yTitle='Predicted Values', showIdentity=True, showBestFit=True, dotSize=6, dotColor='blue', lineColor='red', width=800, height=600, theme='default', backgroundColor='rgba(0,0,0,0)', marginLeft=0, marginRight=0, marginTop=40, marginBottom=0)

Returns a Plotly Figure showing the correlation between the input actual and predicted values. Actual values are displayed on the X-Axis, Predicted values are displayed on the Y-Axis.

Parameters
actuallist

The actual values to display.

predictedlist

The predicted values to display.

titlestr , optional

The desired title to display. Default is “Correlation between Actual and Predicted Values”.

xTitlestr , optional

The desired X-axis title to display. Default is “Actual Values”.

yTitlestr , optional

The desired Y-axis title to display. Default is “Predicted Values”.

showIdentitybool, optional

If set to true, shows the 45 degree line.

showBestFitbool, optional

If set to True, draws the best fit line through the data.

dotSizeint, optional

The marker size

dotColorstr , optional

The desired color of the dots. This can be any plotly color string and may be specified as: - A hex string (e.g. ‘#ff0000’) - An rgb/rgba string (e.g. ‘rgb(255,0,0)’) - An hsl/hsla string (e.g. ‘hsl(0,100%,50%)’) - An hsv/hsva string (e.g. ‘hsv(0,100%,100%)’) - A named CSS color. The default is ‘blue’.

lineColorstr , optional

The desired color of the best fit line. This can be any plotly color string and may be specified as: - A hex string (e.g. ‘#ff0000’) - An rgb/rgba string (e.g. ‘rgb(255,0,0)’) - An hsl/hsla string (e.g. ‘hsl(0,100%,50%)’) - An hsv/hsva string (e.g. ‘hsv(0,100%,100%)’) - A named CSS color. The default is ‘red’.

widthint , optional

The desired width of the figure. Default is 800.

heightint , optional

The desired height of the figure. Default is 600.

themestr , optional

The plotly color scheme to use. The options are “dark”, “light”, “default”. Default is “default”.

backgroundColorlist or str , optional

The desired background color. This can be any color list or plotly color string and may be specified as: - An rgb list (e.g. [255,0,0]) - A cmyk list (e.g. [0.5, 0, 0.25, 0.2]) - A hex string (e.g. ‘#ff0000’) - An rgb/rgba string (e.g. ‘rgb(255,0,0)’) - An hsl/hsla string (e.g. ‘hsl(0,100%,50%)’) - An hsv/hsva string (e.g. ‘hsv(0,100%,100%)’) - A named CSS color. The default is ‘rgba(0,0,0,0)’ (transparent).

marginLeftint , optional

The desired left margin in pixels. Default is 0.

marginRightint , optional

The desired right margin in pixels. Default is 0.

marginTopint , optional

The desired top margin in pixels. Default is 40.

marginBottomint , optional

The desired bottom margin in pixels. Default is 0.

Returns
plotly.Figure

The created plotly figure.

static FigureByData(data, width=950, height=500, xAxis=False, yAxis=False, zAxis=False, axisSize=1, backgroundColor='rgba(0,0,0,0)', marginLeft=0, marginRight=0, marginTop=20, marginBottom=0, tolerance=0.0001)

Creates a plotly figure.

Parameters
datalist

The input list of plotly data.

widthint , optional

The width in pixels of the figure. The default value is 950.

heightint , optional

The height in pixels of the figure. The default value is 950.

xAxisbool , optional

If set to True the x axis is drawn. Otherwise it is not drawn. Default is False.

yAxisbool , optional

If set to True the y axis is drawn. Otherwise it is not drawn. Default is False.

zAxisbool , optional

If set to True the z axis is drawn. Otherwise it is not drawn. Default is False.

axisSizefloat , optional

The size of the X, Y, Z, axes. Default is 1.

backgroundColorlist or str , optional

The desired background color. This can be any color list or plotly color string and may be specified as: - An rgb list (e.g. [255,0,0]) - A cmyk list (e.g. [0.5, 0, 0.25, 0.2]) - A hex string (e.g. ‘#ff0000’) - An rgb/rgba string (e.g. ‘rgb(255,0,0)’) - An hsl/hsla string (e.g. ‘hsl(0,100%,50%)’) - An hsv/hsva string (e.g. ‘hsv(0,100%,100%)’) - A named CSS color. The default is ‘rgba(0,0,0,0)’ (transparent).

marginLeftint , optional

The size in pixels of the left margin. The default value is 0.

marginRightint , optional

The size in pixels of the right margin. The default value is 0.

marginTopint , optional

The size in pixels of the top margin. The default value is 20.

marginBottomint , optional

The size in pixels of the bottom margin. The default value is 0.

tolerancefloat , optional

The desired tolerance. Default is 0.0001.

Returns
plotly.graph_objs._figure.Figure

The created plotly figure.

static FigureByDataFrame(dataFrame, labels=[], width=950, height=500, title='Untitled', xTitle='X Axis', xSpacing=1, yTitle='Y Axis', ySpacing=1.0, useMarkers=False, chartType='Line', backgroundColor='rgba(0,0,0,0)', gridColor='lightgray', marginLeft=0, marginRight=0, marginTop=40, marginBottom=0)

Returns a Plotly Figure of the input dataframe

Parameters
dfpandas.df

The pandas dataframe to display.

data_labelslist

The labels to use for the data.

widthint , optional

The desired width of the figure. Default is 950.

heightint , optional

The desired height of the figure. Default is 500.

titlestr , optional

The chart title. Default is “Training and Testing Results”.

xTitlestr , optional

The X-axis title. Default is “Epochs”.

xSpacingfloat , optional

The X-axis spacing. Default is 1.0.

yTitlestr , optional

The Y-axis title. Default is “Accuracy and Loss”.

ySpacingfloat , optional

The Y-axis spacing. Default is 0.1.

useMarkersbool , optional

If set to True, markers will be displayed. Default is False.

chartTypestr , optional

The desired type of chart. The options are “Line”, “Bar”, or “Scatter”. It is case insensitive. Default is “Line”.

backgroundColorlist or str , optional

The desired background color. This can be any color list or plotly color string and may be specified as: - An rgb list (e.g. [255,0,0]) - A cmyk list (e.g. [0.5, 0, 0.25, 0.2]) - A hex string (e.g. ‘#ff0000’) - An rgb/rgba string (e.g. ‘rgb(255,0,0)’) - An hsl/hsla string (e.g. ‘hsl(0,100%,50%)’) - An hsv/hsva string (e.g. ‘hsv(0,100%,100%)’) - A named CSS color. The default is ‘rgba(0,0,0,0)’ (transparent).

gridstr , optional

The desired background color. This can be any plotly color string and may be specified as: - A hex string (e.g. ‘#ff0000’) - An rgb/rgba string (e.g. ‘rgb(255,0,0)’) - An hsl/hsla string (e.g. ‘hsl(0,100%,50%)’) - An hsv/hsva string (e.g. ‘hsv(0,100%,100%)’) - A named CSS color. The default is ‘lightgray’

marginLeftint , optional

The desired left margin in pixels. Default is 0.

marginRightint , optional

The desired right margin in pixels. Default is 0.

marginTopint , optional

The desired top margin in pixels. Default is 40.

marginBottomint , optional

The desired bottom margin in pixels. Default is 0.

Returns
None.
static FigureByJSONFile(file)

Imports a plotly figure from a JSON file.

Parameters
filefile object

The JSON file.

Returns
plotly.graph_objs._figure.Figure

The imported figure.

static FigureByJSONPath(path)

Imports a plotly figure from a JSON file path.

Parameters
pathstr

The path to the BRep file.

Returns
plotly.graph_objs._figure.Figure

The imported figure.

static FigureByMatrix(matrix, xCategories=[], yCategories=[], minValue=None, maxValue=None, title='Matrix', xTitle='X Axis', yTitle='Y Axis', width=950, height=950, showScale=False, colorScale='gray', colorSamples=10, backgroundColor='rgba(0,0,0,0)', marginLeft=0, marginRight=0, marginTop=40, marginBottom=0, baseFontSize=16, tickFontSize=14, titleFontSize=22, axisTitleFontSize=16, annotationFontSize=18, grayscale=False, mantissa: int = 6)

Returns a Plotly Figure of the input matrix.

Notes

  • Plots matrix values as provided (no implicit normalization).

  • If grayscale is True, the figure becomes publication-friendly:

white background, black axis lines/ticks, grayscale colorscale, and annotation contrast tuned for grayscale.

static FigureByPieChart(data, values, names)

Creates a plotly pie chart figure.

Parameters
datalist

The input list of plotly data.

valueslist

The input list of values.

nameslist

The input list of names.

static FigureByTopology(topology, showVertices=True, vertexSize=1.1, vertexColor='black', vertexLabelKey=None, vertexGroupKey=None, vertexGroups=[], vertexMinGroup=None, vertexMaxGroup=None, showVertexLegend=False, vertexLegendLabel='Topology Vertices', vertexLegendRank=1, vertexLegendGroup=1, showEdges=True, edgeWidth=1, edgeColor='black', edgeLabelKey=None, edgeGroupKey=None, edgeGroups=[], edgeMinGroup=None, edgeMaxGroup=None, showEdgeLegend=False, edgeLegendLabel='Topology Edges', edgeLegendRank=2, edgeLegendGroup=2, showFaces=True, faceOpacity=0.5, faceColor='#FAFAFA', faceLabelKey=None, faceGroupKey=None, faceGroups=[], faceMinGroup=None, faceMaxGroup=None, showFaceLegend=False, faceLegendLabel='Topology Faces', faceLegendRank=3, faceLegendGroup=3, intensityKey=None, width=950, height=500, xAxis=False, yAxis=False, zAxis=False, axisSize=1, backgroundColor='rgba(0,0,0,0)', marginLeft=0, marginRight=0, marginTop=20, marginBottom=0, showScale=False, cbValues=[], cbTicks=5, cbX=-0.15, cbWidth=15, cbOutlineWidth=0, cbTitle='', cbSubTitle='', cbUnits='', colorScale='viridis', mantissa=6, tolerance=0.0001)

Creates a figure from the input topology.

Parameters
topologytopologic_core.Topology

The input topology. This must contain faces and or edges.

showVerticesbool , optional

If set to True the vertices will be drawn. Otherwise, they will not be drawn. Default is True.

vertexSizefloat , optional

The desired size of the vertices. Default is 1.1.

vertexColorstr , optional

The desired color of the output vertices. This can be any plotly color string and may be specified as: - A hex string (e.g. ‘#ff0000’) - An rgb/rgba string (e.g. ‘rgb(255,0,0)’) - An hsl/hsla string (e.g. ‘hsl(0,100%,50%)’) - An hsv/hsva string (e.g. ‘hsv(0,100%,100%)’) - A named CSS color. The default is “black”.

vertexLabelKeystr , optional

The dictionary key to use to display the vertex label. Default is None.

vertexGroupKeystr , optional

The dictionary key to use to display the vertex group. Default is None.

vertexGroupslist , optional

The list of vertex groups against which to index the color of the vertex. Default is [].

vertexMinGroupint or float , optional

For numeric vertexGroups, vertexMinGroup is the desired minimum value for the scaling of colors. This should match the type of value associated with the vertexGroupKey. If set to None, it is set to the minimum value in vertexGroups. Default is None.

edgeMaxGroupint or float , optional

For numeric vertexGroups, vertexMaxGroup is the desired maximum value for the scaling of colors. This should match the type of value associated with the vertexGroupKey. If set to None, it is set to the maximum value in vertexGroups. Default is None.

showVertexLegendbool, optional

If set to True, the legend for the vertices of this topology is shown. Otherwise, it isn’t. Default is False.

vertexLegendLabelstr , optional

The legend label string used to identify vertices. Default is “Topology Vertices”.

vertexLegendRankint , optional

The legend rank order of the vertices of this topology. Default is 1.

vertexLegendGroupint , optional

The number of the vertex legend group to which the vertices of this topology belong. Default is 1.

showEdgesbool , optional

If set to True the edges will be drawn. Otherwise, they will not be drawn. Default is True.

edgeWidthfloat , optional

The desired thickness of the output edges. Default is 1.

edgeColorstr , optional

The desired color of the output edges. This can be any plotly color string and may be specified as: - A hex string (e.g. ‘#ff0000’) - An rgb/rgba string (e.g. ‘rgb(255,0,0)’) - An hsl/hsla string (e.g. ‘hsl(0,100%,50%)’) - An hsv/hsva string (e.g. ‘hsv(0,100%,100%)’) - A named CSS color. The default is “black”.

edgeLabelKeystr , optional

The dictionary key to use to display the edge label. Default is None.

edgeGroupKeystr , optional

The dictionary key to use to display the edge group. Default is None.

edgeGroupslist , optional

The list of edge groups against which to index the color of the edge. Default is [].

edgeMinGroupint or float , optional

For numeric edgeGroups, edgeMinGroup is the desired minimum value for the scaling of colors. This should match the type of value associated with the edgeGroupKey. If set to None, it is set to the minimum value in edgeGroups. Default is None.

edgeMaxGroupint or float , optional

For numeric edgeGroups, edgeMaxGroup is the desired maximum value for the scaling of colors. This should match the type of value associated with the edgeGroupKey. If set to None, it is set to the maximum value in edgeGroups. Default is None.

showEdgeLegendbool, optional

If set to True, the legend for the edges of this topology is shown. Otherwise, it isn’t. Default is False.

edgeLegendLabelstr , optional

The legend label string used to identify edges. Default is “Topology Edges”.

edgeLegendRankint , optional

The legend rank order of the edges of this topology. Default is 2.

edgeLegendGroupint , optional

The number of the edge legend group to which the edges of this topology belong. Default is 2.

showFacesbool , optional

If set to True the faces will be drawn. Otherwise, they will not be drawn. Default is True.

faceOpacityfloat , optional

The desired opacity of the output faces (0=transparent, 1=opaque). Default is 0.5.

faceColorstr , optional

The desired color of the output faces. This can be any plotly color string and may be specified as: - A hex string (e.g. ‘#ff0000’) - An rgb/rgba string (e.g. ‘rgb(255,0,0)’) - An hsl/hsla string (e.g. ‘hsl(0,100%,50%)’) - An hsv/hsva string (e.g. ‘hsv(0,100%,100%)’) - A named CSS color. The default is “#FAFAFA”.

faceLabelKeystr , optional

The dictionary key to use to display the face label. Default is None.

faceGroupKeystr , optional

The dictionary key to use to display the face group. Default is None.

faceGroupslist , optional

The list of face groups against which to index the color of the face. This can bhave numeric or string values. This should match the type of value associated with the faceGroupKey. Default is [].

faceMinGroupint or float , optional

For numeric faceGroups, minGroup is the desired minimum value for the scaling of colors. This should match the type of value associated with the faceGroupKey. If set to None, it is set to the minimum value in faceGroups. Default is None.

faceMaxGroupint or float , optional

For numeric faceGroups, maxGroup is the desired maximum value for the scaling of colors. This should match the type of value associated with the faceGroupKey. If set to None, it is set to the maximum value in faceGroups. Default is None.

showFaceLegendbool, optional

If set to True, the legend for the faces of this topology is shown. Otherwise, it isn’t. Default is False.

faceLegendLabelstr , optional

The legend label string used to idenitfy edges. Default is “Topology Faces”.

faceLegendRankint , optional

The legend rank order of the faces of this topology. Default is 3.

faceLegendGroupint , optional

The number of the face legend group to which the faces of this topology belong. Default is 3.

widthint , optional

The width in pixels of the figure. The default value is 950.

heightint , optional

The height in pixels of the figure. The default value is 950.

xAxisbool , optional

If set to True the x axis is drawn. Otherwise it is not drawn. Default is False.

yAxisbool , optional

If set to True the y axis is drawn. Otherwise it is not drawn. Default is False.

zAxisbool , optional

If set to True the z axis is drawn. Otherwise it is not drawn. Default is False.

backgroundColorlist or str , optional

The desired background color. This can be any color list or plotly color string and may be specified as: - An rgb list (e.g. [255,0,0]) - A cmyk list (e.g. [0.5, 0, 0.25, 0.2]) - A hex string (e.g. ‘#ff0000’) - An rgb/rgba string (e.g. ‘rgb(255,0,0)’) - An hsl/hsla string (e.g. ‘hsl(0,100%,50%)’) - An hsv/hsva string (e.g. ‘hsv(0,100%,100%)’) - A named CSS color. The default is ‘rgba(0,0,0,0)’ (transparent).

marginLeftint , optional

The size in pixels of the left margin. The default value is 0.

marginRightint , optional

The size in pixels of the right margin. The default value is 0.

marginTopint , optional

The size in pixels of the top margin. The default value is 20.

marginBottomint , optional

The size in pixels of the bottom margin. The default value is 0.

cameralist , optional

The desired location of the camera). Default is [-1.25, -1.25, 1.25].

centerlist , optional

The desired center (camera target). Default is [0, 0, 0].

uplist , optional

The desired up vector. Default is [0, 0, 1].

rendererstr , optional

The desired renderer. See Plotly.Renderers(). Default is “notebook”.

intensityKeystr , optional

If not None, the dictionary of each vertex is searched for the value associated with the intensity key. This value is then used to color-code the vertex based on the colorScale. Default is None.

showScalebool , optional

If set to True, the colorbar is shown. Default is False.

cbValueslist , optional

The input list of values to use for the colorbar. Default is [].

cbTicksint , optional

The number of ticks to use on the colorbar. Default is 5.

cbXfloat , optional

The x location of the colorbar. Default is -0.15.

cbWidthint , optional

The width in pixels of the colorbar. Default is 15

cbOutlineWidthint , optional

The width in pixels of the outline of the colorbar. Default is 0.

cbTitlestr , optional

The title of the colorbar. Default is “”.

cbSubTitlestr , optional

The subtitle of the colorbar. Default is “”.

cbUnits: str , optional

The units used in the colorbar. Default is “”

colorScalestr , optional

The desired type of plotly color scales to use (e.g. “viridis”, “plasma”). Default is “viridis”. For a full list of names, see https://plotly.com/python/builtin-colorscales/.

mantissaint , optional

The desired length of the mantissa for the values listed on the colorbar. Default is 6.

tolerancefloat , optional

The desired tolerance. Default is 0.0001.

Returns
Plotly figure
static FigureExportToJSON(figure, path, overwrite=False)

Exports the input plotly figure to a JSON file.

Parameters
figureplotly.graph_objs._figure.Figure

The input plotly figure.

pathstr

The input file path.

overwritebool , optional

If set to True the ouptut file will overwrite any pre-existing file. Otherwise, it won’t.

Returns
bool

True if the export operation is successful. False otherwise.

static FigureExportToPDF(figure, path, width=1920, height=1200, overwrite=False)

Exports the input plotly figure to a PDF file.

Parameters
figureplotly.graph_objs._figure.Figure

The input plotly figure.

pathstr

The input file path.

widthint, optional

The width of the exported image in pixels. Default is 1920.

heightint , optional

The height of the exported image in pixels. Default is 1200.

overwritebool , optional

If set to True the ouptut file will overwrite any pre-existing file. Otherwise, it won’t.

Returns
bool

True if the export operation is successful. False otherwise.

static FigureExportToPNG(figure, path, width=1920, height=1200, overwrite=False)

Exports the input plotly figure to a PNG file.

Parameters
figureplotly.graph_objs._figure.Figure

The input plotly figure.

pathstr

The input file path.

widthint, optional

The width of the exported image in pixels. Default is 1920.

heightint , optional

The height of the exported image in pixels. Default is 1200.

overwritebool , optional

If set to True the ouptut file will overwrite any pre-existing file. Otherwise, it won’t.

Returns
bool

True if the export operation is successful. False otherwise.

static FigureExportToSVG(figure, path, width=1920, height=1200, overwrite=False)

Exports the input plotly figure to a SVG file.

Parameters
figureplotly.graph_objs._figure.Figure

The input plotly figure.

pathstr

The input file path.

widthint, optional

The width of the exported image in pixels. Default is 1920.

heightint , optional

The height of the exported image in pixels. Default is 1200.

overwritebool , optional

If set to True the ouptut file will overwrite any pre-existing file. Otherwise, it won’t.

Returns
bool

True if the export operation is successful. False otherwise.

static Renderer()

Return the renderer most suitable for the environment in which the script is running.

Parameters
Returns
str

The most suitable renderer type for the environment in which the script is running. Currently, this is limited to: - “vscode” if running in Visual Studio Code - “colab” if running in Google Colab - “iframe” if running in jupyter notebook or jupyterlab - “browser” if running in anything else

static Renderers()

Returns a list of the available plotly renderers.

Parameters
Returns
list

The list of the available plotly renderers.

static SetCamera(figure, camera=[-1.25, -1.25, 1.25], center=[0, 0, 0], up=[0, 0, 1], projection='perspective')

Sets the camera for the input figure.

Parameters
figureplotly.graph_objs._figure.Figure

The input plotly figure.

cameralist , optional

The desired location of the camera. Default is [-1.25, -1.25, 1.25].

centerlist , optional

The desired center (camera target). Default is [0, 0, 0].

uplist , optional

The desired up vector. Default is [0, 0, 1].

projectionstr , optional

The desired type of projection. The options are “orthographic” or “perspective”. It is case insensitive. Default is “perspective”

Returns
plotly.graph_objs._figure.Figure

The updated figure

static Show(figure, camera=[-1.25, -1.25, 1.25], center=[0, 0, 0], up=[0, 0, 1], renderer=None, projection='perspective')

Shows the input figure.

Parameters
figureplotly.graph_objs._figure.Figure

The input plotly figure.

cameralist , optional

The desired location of the camera. Default is [0, 0, 0].

centerlist , optional

The desired center (camera target). Default is [0, 0, 0].

uplist , optional

The desired up vector. Default is [0, 0, 1].

rendererstr , optional

The desired renderer. See Plotly.Renderers(). If set to None, the code will attempt to discover the most suitable renderer. Default is None.

projectionstr, optional

The desired type of projection. The options are “orthographic” or “perspective”. It is case insensitive. Default is “perspective”

Returns
None
static edgeData(vertices, edges, dictionaries=None, color='black', colorKey=None, width=1, widthKey=None, dash=False, dashKey=None, directed=False, arrowSize=0.1, arrowSizeKey=None, labelKey=None, showEdgeLabel=False, groupKey=None, minGroup=None, maxGroup=None, groups=[], legendLabel='Topology Edges', legendGroup=2, legendRank=2, showLegend=True, colorScale='Viridis')
static vertexData(vertices, dictionaries=[], color='black', colorKey=None, size=1.1, sizeKey=None, borderColor='black', borderWidth=0, borderColorKey=None, borderWidthKey=None, labelKey=None, showVertexLabel=False, vertexLabelFontSize=5, groupKey=None, minGroup=None, maxGroup=None, groups=[], legendLabel='Topology Vertices', legendGroup=1, legendRank=1, showLegend=True, colorScale='Viridis')