plotly / dash-cytoscape

Interactive network visualization in Python and Dash, powered by Cytoscape.js

Home Page:https://dash.plot.ly/cytoscape

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Latex support for cytoscape

loijord opened this issue · comments

Is it possible to embed LaTeX formulas in nodes of cytoscape? I've tried this but it's not rendering:

import dash
from dash import dcc
from dash import html
import dash_cytoscape as cyto


app = dash.Dash(__name__, external_scripts=[
  'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-MML-AM_CHTML',
])

EMC2 = '$E=mc^2$'

app.layout = html.Div([
    cyto.Cytoscape(
        id='cytoscape-two-nodes',
        layout={'name': 'preset'},
        style={'width': '100%', 'height': '400px'},
        elements=[
            {'data': {'id': 'one', 'label': EMC2}, 'position': {'x': 75, 'y': 75}},
            {'data': {'id': 'two', 'label': 'Node 2'}, 'position': {'x': 200, 'y': 200}},
            {'data': {'source': 'one', 'target': 'two'}}
        ]
    )
])

if __name__ == '__main__':
    app.run_server(debug=True, port=8865)