draw_map()
Draw the causal map as an interactive page.
draw_map(
cmap: dict,
papers: list[dict] | None = None,
save: str | None = None,
title: str = 'Causal map',
height: int = FRAME_HEIGHT,
) -> None
Source: theoryminer/causal_map.py
In a notebook, the page shows in the cell output. In a plain Python script, the function writes the page to causal_map.html. The page is one HTML file that works offline. On the page you can hover over a node or an edge, click an edge to read all its sentences, search, drag, zoom, change the filters, and save a picture (PNG, JPG or SVG). The page gets every edge, also the hidden edges, and its sliders start at the filter values of causal_map().
Arguments
cmap
The map to draw.
- Values: the result of causal_map().
- Default: none. Give the map.
papers
The source of each paper, shown with each sentence: the DOI as a link, else the paper title, else the file name.
- Values: None, or the rows of extract_dois() (they replace the papers of the map).
- Default
None: use cmap[“papers”], the DOI and title that harvest() found for each paper. A map from relations without them shows the doc_id (the file name) of each paper.
save
Where to write the page as an HTML file, in addition to the notebook output.
- Values: None, or a path such as “outputs/map.html”.
- Default
None: write no file in a notebook, and causal_map.html in a script.
title
The title at the top of the page.
- Values: any text.
- Default “Causal map”.
height
The height of the map in a notebook cell.
- Values: a whole number of pixels.
- Default 720.
Returns
None. The function shows the page, or writes the file, or both.
Example
>>> draw_map(cmap)
>>> draw_map(cmap, save="outputs/map.html")
saved page: outputs/map.html