Saltar al contenido principal
K

dsh-figextract

k39846336-collab/dsh-figextract

Extracts plotted values from PNG and JPEG figures by detecting axis ticks, colour series, bars and error-bar caps, then calibrating pixel positions to numbers.

Instalar

dsh plugin --profile web add github:k39846336-collab/dsh-figextract

README

Figure data extractor

Pull numeric values out of figure images. Useful when a paper reports a bar chart but you need the underlying numbers for a meta-analysis, a re-plot, or a data table.

Everything runs locally on your machine. No upload, no OCR service, no API key.

What it recognises

  • Plot frame — the longest near-neutral dark vertical and horizontal lines; a boxed frame is detected too.
  • Axis ticks — short marks protruding outside the frame on the left and bottom edges.
  • Colour series — coloured pixels are grouped into connected components and clustered by hue, so a grouped bar chart reports one series per colour.
  • Bars — components that sit on the x-axis and are wider than a few pixels.
  • Error-bar caps — short horizontal dark segments above a bar top.

Usage

Ask the agent to inspect a figure first:

Inspect D:\figs\fig3a.png with figextract

The report lists the plot frame, the pixel row of every y tick, the detected colour series and the number of bars. Then supply a calibration — two ticks whose labels you can read off the image:

Extract D:\figs\fig3a.png with yRefs [{px: 512, value: 0}, {px: 128, value: 8}]

Values come back as rows of {series, x, y, yUpper}. Use action: save with an outPath to write a CSV.

Limitations

  • PNG and JPEG only. Convert PDF figures first (pdftoppm, magick, or any viewer).
  • Crop to one figure. Feeding a whole page lets justified text lines look like axis lines; pass crop: {x0, y0, x1, y1} or use autocrop on a tight figure crop.
  • Axes must be linear or log with visible ticks. Broken axes, reversed axes and three-axis panels need manual handling.
  • Colour-coded bars only. Hatched, gradient-filled or black-and-white bars are not separated into series yet.
  • Values are read at bar tops. Box plots, scatter clouds and line charts are not covered by this milestone.

Roadmap

  • M2 — in-editor panel with click-to-calibrate and live preview
  • M3 — enhanced recognition: panel splitting, box-plot statistics, hatched fills
  • M4 — vision assist for axis labels and multi-panel layout

License

MIT.

Plugins relacionados