semantica.visualization renders knowledge graphs, ontologies, embedding spaces, and temporal data as interactive HTML or static images: without launching the full Explorer server:
  • KGVisualizer: interactive network with force, hierarchical, and circular layouts
  • EmbeddingVisualizer: 2D/3D UMAP or t-SNE projections with cluster labels
  • TemporalVisualizer: timeline views and graph evolution across snapshots
  • AnalyticsVisualizer: centrality scores, community structure, degree distribution charts
Requires plotly: pip install plotly. Some exporters also need matplotlib or graphviz.

Exported Classes

ClassRole
KGVisualizerInteractive network, community, and subgraph rendering with force/hierarchical/circular layouts
OntologyVisualizerClass hierarchy and property relationship diagrams from any ontology
EmbeddingVisualizer2D/3D UMAP or t-SNE projection of embedding spaces with cluster labels
SemanticNetworkVisualizerWeighted semantic network rendering
AnalyticsVisualizerCentrality scores, community structure, connectivity, and degree distribution charts
TemporalVisualizerTimeline views and graph evolution across snapshots

Quick Start

1

Render a knowledge graph

from semantica.visualization import KGVisualizer

viz = KGVisualizer(layout="force", color_scheme="default")

# Interactive: opens in browser, supports hover and click
viz.visualize_network(graph, output="interactive")
2

Apply layout and color options

viz = KGVisualizer(layout="force", color_scheme="vibrant")

viz.visualize_network(
    graph,
    output="html",
    file_path="graph.html",
    node_color_by="type",      # color nodes by entity type attribute
)
3

Export to static formats

# Static PNG: for reports and embedding in documents
viz.visualize_network(graph, output="png", file_path="graph.png")

# Vector SVG: for publications and scalable diagrams
viz.visualize_network(graph, output="svg", file_path="graph.svg")
plotly is required for all visualizers. Install before use: pip install plotly. All visualizer methods raise ProcessingError if Plotly is not installed.

Visualizers

Interactive and static knowledge graph rendering:
from semantica.visualization import KGVisualizer

viz = KGVisualizer(layout="force", color_scheme="default")

# Interactive: opens in browser
viz.visualize_network(graph, output="interactive")

# Save as HTML file
viz.visualize_network(graph, output="html", file_path="graph.html")

# Static PNG
viz.visualize_network(graph, output="png", file_path="graph.png")

# Community-colored graph
viz.visualize_communities(graph, communities, file_path="communities.html")

# Centrality-sized nodes
viz.visualize_centrality(graph, centrality, centrality_type="degree")

# Entity type distribution bar chart
viz.visualize_entity_types(graph, output="interactive")

# Relationship frequency heatmap
viz.visualize_relationship_matrix(graph, output="interactive")
Use max_nodes for large graphs. Force-directed layouts become unreadable and slow above ~1,000 nodes. Filter to a subgraph before visualizing large graphs.
HTML output is always the best starting point. Interactive HTML lets you zoom, pan, and hover for details. Only export to PNG/SVG/PDF when embedding in a report.
For interactive dashboards, prefer Explorer. KGVisualizer.visualize_network() generates a self-contained HTML file. The Explorer CLI (semantica-explorer) gives a full live web app with search, filtering, path-finding, and REST API.
Layout options (layout=):
LayoutDescriptionBest For
forcePhysics simulation: clusters emerge naturallyGeneral graphs
hierarchicalTop-down tree layoutTaxonomies, org charts
circularNodes on a circle, edges as chordsSmall dense graphs

Color Schemes

All visualizers accept a color_scheme= constructor parameter:
viz = KGVisualizer(color_scheme="vibrant")
SchemeDescriptionBest For
defaultBlue-grey paletteGeneral use
vibrantHigh-contrast, saturated coloursPresentations
pastelSoft, muted tonesLight backgrounds
darkDark background with bright nodesDark-mode dashboards
lightWhite background, thin edgesPublications, print
colorblindOkabe-Ito safe paletteAccessibility
Use color_scheme="colorblind" in publications and dashboards. The Okabe-Ito palette is readable for everyone, including the ~8% of readers who are red-green colorblind.

Export Formats

FormatInteractiveScalableBest For
.htmlYesN/AWeb dashboards, exploratory analysis
.pngNoNoReports, Jupyter notebooks
.svgNoYesPublications, slide decks
.pdfNoYesPrint, compliance exports

Convenience Functions

from semantica.visualization import (
    visualize_kg, visualize_ontology, visualize_embeddings,
    visualize_semantic_network, visualize_analytics, visualize_temporal,
)

# Returns Plotly figure or None
fig = visualize_kg(graph, output="interactive", method="default")
fig = visualize_ontology(ontology, output="interactive", method="hierarchy")
fig = visualize_embeddings(embeddings, labels, output="interactive", method="2d_projection")
fig = visualize_analytics(analytics_data, output="interactive", method="centrality")
fig = visualize_temporal(temporal_data, output="interactive", method="timeline")

Graph Explorer (Full Dashboard)

For a full browser-based UI with search, path finding, and the Ontology Hub, launch the Explorer CLI:
semantica-explorer --graph my_graph.json
See the Explorer reference for the full feature set and REST API.

Knowledge Graph

The graph being visualized.

Ontology

Visualize ontology class structure.

Embeddings

Generate the embeddings visualized here.

Explorer

Full interactive Knowledge Explorer UI.