VisJS network interface#
VisJS offers nice graph displays.
- gismap.gisgraphs.builder.make_vis(lab, **kwargs)[source]#
Generate HTML visualization of a lab’s collaboration network.
- Parameters:
lab (
LabMap) – Lab to display.uid (
str, optional) – Unique identifier for DOM elements. Auto-generated if not provided.vis_url (
str, optional) – URL to vis-network library.groups (
dict, optional) – Group styling configuration.draw_legend (
bool, optional) – Whether to draw the legend. Defaults to True if multiple groups.physics (
dict, optional) – Physics engine configuration.nodes_options (
dict, optional) – Node styling options.edges_options (
dict, optional) – Edge styling options.interaction_options (
dict, optional) – Interaction settings.style (
string.Template, optional) – CSS template.script (
string.Template, optional) – JavaScript template.inline_images (
bool, default=True) – If True, fetch each node image and embed it as adata:URI so the canvas stays clean and PNG export works. Images that fail to download or exceedmax_inline_bytesare demoted to the initials fallback (no external URL is ever left on a node).max_inline_bytes (
int, default=200_000) – Skip inlining for any image larger than this (e.g. uncropped LDAP portraits). The node is demoted to initials.
- Returns:
HTML code as a string.
- Return type:
- gismap.gisgraphs.graph.lab_to_graph(lab)[source]#
- Parameters:
lab (
LabMap) – A lab populated with authors and publications.- Returns:
(nodes, edges, publications)wherenodesandedgescarry only display data pluspub_keysreferences, andpublicationsis a dict keyed by publication key with the full per-pub payload (title, authors, venue, year, url, abstract, bib). Modal HTML is built JS-side from this shared dict, so each publication is shipped only once even when it touches many authors and pairs.- Return type:
Examples
>>> from gismap.lab import ListMap as Map >>> lab = Map(author_list=['Tixeuil Sébastien', 'Mathieu Fabien'], name='mini', dbs="hal") >>> lab.update_authors() >>> lab.update_publis() >>> len(lab.authors) 2 >>> 320 < len(lab.publications) < 430 True >>> nodes, edges, pubs = lab_to_graph(lab) >>> nodes[0]['group'] 'mini' >>> edges[0]['hover'] 'Show joint publications from Mathieu Fabien and Tixeuil Sébastien' >>> sample = next(iter(pubs.values())) >>> {'title', 'authors', 'bib'} <= set(sample) True >>> html = lab.html(groups={"mini": {"color": "#777"}})
- class gismap.gisgraphs.widget.GismapWidget[source]#
A simple widget to test the production of LabMaps and EgoMaps.
Examples
This is a doctest example. Use a notebook to play with the widget.
>>> gw = GismapWidget() VBox(children=(HTML(value=''), Output(), HBox(children=(Textarea(value='', ... >>> gw.names.value = "Fabien Mathieu" >>> gw.dbs.value = "HAL" >>> gw.size.value = 3 >>> gw.compute_function(gw.compute, show=False) >>> gw.save_link.value[:30] "<a href='data:text/html;base64" >>> gw.names.value = "Diego Perino, Laurent Viennot" >>> gw.compute_function(gw.compute, show=False) >>> gw.save_link.value[:30] "<a href='data:text/html;base64"