Scientific figures in Python, laid out in millimetres.

Inklet draws a chart from a table in one call and sets it in physical millimetres. It measures labels, ticks and legends before placing the data, then writes SVG, PDF and PNG from the same geometry.

pip install inklet

Requires Python 3.11 or later. See installation options for rendering extras.

growth.py
import inklet as i

df = {'day': [0, 2, 4, 6, 8],
      'treated': [0, 3, 5, 6, 6.5],
      'control': [0, 1, 1.5, 2, 2.2]}
chart = i.line(df, x='day', y=['treated', 'control'], markers=True,
               ylabel='signal (a.u.)')
chart.save('growth.svg')
Line chart of signal against day: the treated series rises from 0 to 6.5 and the control series from 0 to 2.2, each with markers and a legend
Output of the code: growth.svg, 89 × 63 mm. Open the SVG

Why inklet

  • Journal widths in millimetres: 89 mm single column and 183 mm double column.

  • inklet check reports overlaps, text overflow, off-page marks and low contrast.

  • For coding agents: inklet guide prints the usage guide, and inklet skill installs it.

  • Matplotlib figures come across with i.from_matplotlib(fig).

A full journal page from one script

Thirteen panels on a 183 mm page with the scientific.cell preset: 6 pt text, 0.25 pt hairlines and legends placed in empty data space. Each panel is a plot or diagram in a 12-column document.

  1. a Circuit diagram with routed links
  2. b, j Stacked and diverging bars with value labels
  3. c, g Dumbbells across 7 and 36 categories
  4. d Scatter with labelled points
  5. e, l Heatmap with zoom inset, correlation matrix
  6. f, k Cumulative distributions, log–log counts
  7. h, i, m Radar, donut and violins
A thirteen-panel figure page with a circuit diagram, bars, dumbbells, a labelled scatter, heatmaps, cumulative distributions, a dot plot, radar, donut, diverging bars, a log-log plot, a correlation matrix and violins
Output of examples/dense_figure.py. All data are simulated.

Besides lines, bars, histograms and heatmaps, each of these is one method on a plot.

From script to page

This script builds the two-panel figure from the first figure tutorial. The double-column preset fixes the page width at 183 mm, and Inklet sizes each plot region around its measured labels.

two_panels.py
import inklet as i

data = i.dataset(
    {'time': [0, 1, 2, 3], 'signal': [1, 4, 3, 5]},
    name='response', units={'time': 's', 'signal': 'mV'},
)
response = i.plot_spec(x=(0, 3), y=(0, 6))
response.line(data.points('time', 'signal'),
              name='Signal', stroke='#176b9b')
response.axes(x='Elapsed time / s', y='Signal / mV')
response.legend(side='bottom')

groups = ['Control', 'Treatment']
summary = i.plot_spec(x=groups, y=(0, 8))
summary.bars(groups, [3, 6], bar_colors=['#176b9b', '#198c83'])
summary.axes(y='Outcome / a.u.')

page = i.publication('double-column').document(columns=2, gap=8)
page.add('response', response, row=0, column=0, min_height=60)
page.add('summary', summary, row=0, column=1, min_height=60)
page.letters()
page.compile().save('two-panels.svg', 'two-panels.pdf')
Output of the script: panel a shows a signal line over elapsed time, panel b shows bars for control and treatment
Output: two-panels.svg, 183 × 68 mm. Open the SVG or the PDF.
  • Physical page sizes

    Presets such as single-column (89 mm) and double-column (183 mm) set the page width and type size. Type and strokes keep their size when the page changes.

  • Measured layout

    Axis labels, tick labels and legends are measured with the embedded fonts before the data region is placed, so panels in a row keep aligned data areas. See figures and layout.

  • Vector exports and lint

    SVG and PDF are written from one resolved geometry, with text embedded as editable text. lint() reports small text, thin strokes and overlaps. See export and review.

  • Revisable data

    Update a dataset and compile again. Earlier snapshots stay unchanged, and each revision is recorded in the metadata.

Figures built with Inklet

All 23 figures in the gallery

Find your way around

Each section starts with an overview page of examples.

Start with one call

Charts in one call draws a chart from a table in a single line, and the chart gallery shows every type with the code that drew it. The one-call API is a front door to the document model, so a chart can move to the document API when a figure needs more. For several panels on a journal page, install Inklet and follow the first figure tutorial to draw, revise and export a page. If your data already lives in a table, start with CSV to figure.

Read the authoring model before building reusable figures: it explains which objects remain editable, how data changes reach a plot, and what a compiled export preserves.

Find the right guide

You want to… Start here
Make a chart from a table in one call Charts in one call
See every one-call chart type with its code Chart gallery
Have a coding agent make your figures Use with coding agents
Redraw a matplotlib figure in Inklet Bring matplotlib figures
Recreate published figures from their data Published figures, recreated
Make and export your first figure First figure tutorial
Choose a plot for your data Plot type gallery
Put a dozen panels on one journal page Dense figure pages
Set page width, spans and panel letters in millimetres Panel layout
Match a journal's type sizes and strokes Presets
Combine marks, legends and insets Build and combine plots
Set scales, tick labels and fonts Axes, scales and text
Draw measured components and connections Diagrams
Add images, meshes or Blender scenes 3D and images
Check a figure and save SVG, PDF and PNG Export and review
See complete figures with source Figure gallery
Plot calibrated microscopy volumes, sections and label measurements Microscopy volumes
Build an offline interactive report Experimental features

Reference

Python API · CLI · Cookbook · Troubleshooting · Compatibility · Migration

The default install is stable 4.10.0. The compatibility page states the supported API and saved-file policy, and the migration guide covers existing recipes. Release process, engine studies and earlier guides are in the development notes.

Search documentation

Type to search guides, examples and the API.