> For the complete documentation index, see [llms.txt](https://docs.mithrl.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mithrl.com/features/interactive-charts.md).

# Interactive Charts

## Charts <a href="#user-content-charts" id="user-content-charts"></a>

Mithrl draws every chart as a live figure. You ask for a chart in plain language, then read, select, edit and export it yourself, with the data still attached. Changing a label, a colour or the legend position takes a click and never redraws anything you didn't touch.

The examples on this page follow one liver-safety study: five hepatotoxicants, including troglitazone, tested on HepG2 spheroids.

### Chart types <a href="#user-content-chart-types" id="user-content-chart-types"></a>

Mithrl has 21 chart types, with more than 440 chart-specific settings on top of the size, style, text and export controls every chart shares.

<figure><img src="https://626853399-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWzmerQ3GQmDagWwm1Oeg%2Fuploads%2FTIGJ80UlmHbXJCZusfNW%2Fchart-types.jpg?alt=media&amp;token=57f376f2-34af-4af9-8891-7c56e193d18d" alt="Grid of the 21 chart types: volcano, heatmap, dose response, bar chart, distribution, scatter, UMAP, enrichment, GO tree, network, cell-cell chord, Sankey flow, hierarchy, set overlap, survival, forest plot, ROC and PR, run QC, plate map, flow gating and composite"><figcaption><p>The 21 chart types</p></figcaption></figure>

**Flow gating** draws gates with the population tree and event counts. **Composite** combines several panels into one publication figure.

### Ask for a chart

Type what you want in the message box, the way you would ask a colleague:

> Fit dose-response curves for the five hepatotoxicants on the HepG2 spheroid panel and show the IC50 for each.

<figure><img src="https://626853399-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWzmerQ3GQmDagWwm1Oeg%2Fuploads%2FDwklOrL2Y3s49qK86POQ%2Fask-for-a-chart-annotated.jpg?alt=media&amp;token=57dcc034-f2eb-4fed-a15d-b097bd8b516a" alt="A dose-response prompt and the live dose-response chart Mithrl returns"><figcaption></figcaption></figure>

Name the data, the comparison and what to label. Prompts that work:

* Fit dose-response curves for each compound and show the IC50.
* Make a volcano plot of troglitazone vs vehicle. Label the top 10 genes.
* Plot overall survival by arm as a Kaplan-Meier curve with a risk table.
* Gate live singlet lymphocytes, then CD3+ T cells, on this FCS file.

### Read a chart

#### The chart card

Every chart arrives as a card with its own toolbar.

<figure><img src="https://626853399-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWzmerQ3GQmDagWwm1Oeg%2Fuploads%2FnrHNInXz21o30wy7ZdqX%2Fchart-card-annotated.jpg?alt=media&amp;token=9f2fcf0b-c985-424a-9d60-757c257d6d5c" alt="A volcano plot chart card with its version badge, pointer tools, Save and Publish buttons, data table, download and edit buttons, and legend"><figcaption><p>Chart card</p></figcaption></figure>

#### Exact values and the Explorer

<figure><img src="https://626853399-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWzmerQ3GQmDagWwm1Oeg%2Fuploads%2FBCsp0gAxfGhLD2omGi89%2Fhover-annotated.jpg?alt=media&amp;token=6a571f50-a512-42d9-8e58-45c2a63812a8" alt="Hovering over ATF3 on the volcano plot shows its fold change and P value"><figcaption></figcaption></figure>

<figure><img src="https://626853399-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWzmerQ3GQmDagWwm1Oeg%2Fuploads%2FebiqBqHZDDEzUOpPQhaA%2Fexplorer-annotated.jpg?alt=media&amp;token=7a0a350b-fa6a-4dab-b20f-7647c2454968" alt="The Explorer listing the session&#x27;s charts grouped by analysis"><figcaption></figcaption></figure>

### Select part of a chart

The pointer tools select points or regions on any chart. A selection can be highlighted for your audience, or attached to a question for the agent.

#### Spotlight a selection

<figure><img src="https://626853399-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWzmerQ3GQmDagWwm1Oeg%2Fuploads%2F8ARcecaacB2zgPwmtVNH%2Flasso-tool-annotated.jpg?alt=media&amp;token=b4314fd3-e897-479b-b488-eb38df3b9030" alt="The Lasso tool selected in the chart toolbar"><figcaption></figcaption></figure>

<figure><img src="https://626853399-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWzmerQ3GQmDagWwm1Oeg%2Fuploads%2Fq2grEQy5GWLlQK1t7Rh9%2Flasso-drawn-annotated.jpg?alt=media&amp;token=2b5b86bc-5ddc-44ac-9814-7946ed8579bb" alt="A lasso drawn around eight up-regulated genes, with the selection bar below the chart"><figcaption></figcaption></figure>

<figure><img src="https://626853399-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWzmerQ3GQmDagWwm1Oeg%2Fuploads%2FqjiKN0KZpOTN3kRakUh4%2Fspotlight-annotated.jpg?alt=media&amp;token=9ac3d969-eb57-43ed-8a9f-ec0bff4c300a" alt="Spotlight applied: genes outside the selection are faded&#x22;"><figcaption></figcaption></figure>

#### Ask about a selection

Click **Ask agent** in the selection bar to attach the selection to your next message. The agent then answers about exactly those points.

<figure><img src="https://626853399-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWzmerQ3GQmDagWwm1Oeg%2Fuploads%2FyQenslc8fdCoSxTAxu5h%2Fask-selection-annotated.jpg?alt=media&amp;token=cc80ca8f-41ae-4202-b0c3-25ff127a462d" alt="The message box with the volcano plot selection attached and a question typed"><figcaption></figcaption></figure>

<figure><img src="https://626853399-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWzmerQ3GQmDagWwm1Oeg%2Fuploads%2FOOkG702CRR851nstMqMg%2Fask-answer.jpg?alt=media&amp;token=194a5f26-5ae3-48a2-b137-39449a19607f" alt="Mithrl&#x27;s answer about the eight selected genes"><figcaption><p>The answer covers only the eight selected genes: ATF4 stress-response targets, including the liver-injury markers ATF3 and DDIT3</p></figcaption></figure>

For anything other than points, use **Box**: drag over a block of a heatmap or a stretch of a curve, then ask about it.

<figure><img src="https://626853399-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWzmerQ3GQmDagWwm1Oeg%2Fuploads%2FdrEMton0Ifkv1KtJkWZV%2Fbox-selection-annotated.jpg?alt=media&amp;token=48bee5cb-1bfa-4b58-99af-676fdd19fcee" alt=""><figcaption><p>A box selection over a block of a clustered heatmap</p></figcaption></figure>

#### Flow cytometry

The same tools work on gating plots. In this example, 42 lymphocytes sit outside both the T cell and B cell gates.

<figure><img src="https://626853399-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWzmerQ3GQmDagWwm1Oeg%2Fuploads%2F2VidhGXDIfsL4amOrzfz%2Fflow-gating-annotated.jpg?alt=media&amp;token=b45ddbdb-82e4-456c-95fb-7ed2acdceeff" alt="A flow cytometry gating plot with ungated events selected by Box and the population tree"><figcaption></figcaption></figure>

<figure><img src="https://626853399-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWzmerQ3GQmDagWwm1Oeg%2Fuploads%2Fn0nHtRzYvTvnJRGmMNwe%2Fflow-gating-ask.jpg?alt=media&amp;token=1c6b043d-342a-4960-90af-92682d95e84c" alt="A question about the 42 selected events"><figcaption></figcaption></figure>

<figure><img src="https://626853399-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWzmerQ3GQmDagWwm1Oeg%2Fuploads%2FMPre9PhFruLLAr1b1KHQ%2Fflow-gating-answer.jpg?alt=media&amp;token=92497c4d-430d-4300-88c1-d0d1617b1e52" alt="Mithrl identifies most of the events as NK cells and adds an NK cell gate"><figcaption><p>Mithrl identifies the events, adds an NK cell gate, and suggests the next plot</p></figcaption></figure>

### Edit a chart

Click the pencil on any chart card to open the editor.

<figure><img src="https://626853399-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWzmerQ3GQmDagWwm1Oeg%2Fuploads%2FZGmYh1ptJRL2rAMXuW3o%2Feditor-annotated.jpg?alt=media&amp;token=6cc2cfe1-bd64-4f1c-9f12-af4d9d49546b" alt="The chart editor with the figure on the left and the settings panels on the right"><figcaption><p>Chart editor</p></figcaption></figure>

#### The nine panels

| Panel         | What it does                                                                                                       |
| ------------- | ------------------------------------------------------------------------------------------------------------------ |
| 1. Element    | Lists every part of the figure as a layer. Click a layer to select it, or hover to hide it.                        |
| 2. Parameters | Cut-offs you can type or drag, draggable threshold lines, gene labels and statistics.                              |
| 3. Figure     | Size (1 column, 2 columns, slide), one-click styles including ggplot2, Nature and Prism, and a colour-blind check. |
| 4. Marks      | Each group's name, colour and visibility, plus marker shape, size and opacity.                                     |
| 5. Annotate   | Text, arrows, significance brackets, shapes and reference lines.                                                   |
| 6. Spotlight  | Fades everything except one area, and can ask the agent about it.                                                  |
| 7. Highlights | Marks your own gene lists on the chart. Name a set and paste genes, one per line.                                  |
| 8. Download   | PNG, SVG or Prism export at journal sizes (89 mm, 183 mm, 16:9) and chat, slide or print resolution.               |
| 9. History    | Undo and redo, every saved version, and style templates your team can reuse.                                       |

<figure><img src="https://626853399-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWzmerQ3GQmDagWwm1Oeg%2Fuploads%2Fc6vXQCCoWyEC912Sv3GF%2Feditor-panels-1-4.jpg?alt=media&amp;token=af48c507-4b6d-4285-b5ab-fac4637ae13a" alt="Panels 1 to 4: Element, Parameters, Figure and Marks"><figcaption><p>Panels 1 to 4</p></figcaption></figure>

<figure><img src="https://626853399-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWzmerQ3GQmDagWwm1Oeg%2Fuploads%2FqVdPgraOhnRByfg0Em9n%2Feditor-panels-5-9.jpg?alt=media&amp;token=d8f2dccc-9bba-4beb-8f35-f0c8fed96928" alt="Panels 5 to 9: Annotate, Spotlight, Highlights, Download and History"><figcaption><p>Panels 5 to 9</p></figcaption></figure>

### Save, publish and restore versions

<figure><img src="https://626853399-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWzmerQ3GQmDagWwm1Oeg%2Fuploads%2FqOQ1yvFU0LX75uF9Q9zI%2Fversions-annotated.jpg?alt=media&amp;token=4167bede-99d3-4906-a7b3-d867b9804b76" alt="Four steps of the version badge: Edited, saved as draft v3, published v3, and the version list"><figcaption></figcaption></figure>

Saving never overwrites an earlier version, and downloads always use the latest saved version.

### Charts drawn with code

For a chart type Mithrl doesn't have, ask for it and name the tool: matplotlib, seaborn, Plotly, or ggplot2 in R. Mithrl writes and runs the code in your project.

<figure><img src="https://626853399-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWzmerQ3GQmDagWwm1Oeg%2Fuploads%2F01CLAH236txJlShB6Iw6%2Fcode-chart-prompt.jpg?alt=media&amp;token=e31c80fb-8151-400e-9f58-574416f18fff" alt="A prompt asking for a Manhattan plot with matplotlib"><figcaption></figcaption></figure>

<figure><img src="https://626853399-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWzmerQ3GQmDagWwm1Oeg%2Fuploads%2FFwJzdLtD8wutDaFS4UJE%2Fcode-chart-annotated.jpg?alt=media&amp;token=a89d73b1-8c0b-426a-8b05-f7873717c89f" alt="The Manhattan plot Mithrl drew with matplotlib, and its note that the code is saved as manhattan.py"><figcaption></figcaption></figure>

To change a code-drawn chart, ask again. The nine editing panels work on Mithrl's own chart types only.

Prompts to try:

* Make this as a Manhattan plot with matplotlib and save the code.
* Draw this in R with ggplot2 and ggrepel, theme\_classic. Show me the code.

### Try it

1. Ask for a volcano plot of your own results and label the top 10 genes.
2. Lasso the top hits and ask the agent what they have in common.
3. Switch to the ggplot2 style, save, publish, and download an SVG.

To export a whole session at once, export it as an HTML report or a PowerPoint deck. Every chart comes out as it looks in Mithrl.
