Graph Digitizer

The Graph Digitizer Tool is a MATLAB script that enables users to extract data points from graphs in images.
377 Downloads
Updated 13 Nov 2024

View License

The Graph Digitizer Tool is a MATLAB script that enables users to extract data points from graphs in images. The graphical interface allows users to load an image, select the desired region, and digitize the graph with ease. The tool employs a digitization algorithm that traces the graph from the initial point, selecting the nearest point to the previously digitized one. It also provides options to adjust the marker size, threshold factor, and moving average window size to optimize the digitization process and ensure accurate results.
Note: This software is designed for approximate graph digitization only and should not be used for applications requiring high measurement accuracy. The digitization process may introduce some inaccuracies due to manual tracing and resolution dependency, potentially resulting in noise and deviations in the digitized data.
Key features:
- Load images in various formats (JPEG, PNG, BMP)
- Export digitized data to Excel, text files or workspace
- View digitized data in a tabular format
Usage:
1. Getting Started
Launch the DigitizeGraph application. After launching, the LOAD IMAGE button becomes available for image loading.
2. Loading an Image
Clicking the LOAD IMAGE button opens a file selection dialog. Select the image with the graph you need to digitize. A test image of cognitive evoked potentials is available in the archive with the program.
3. Setting Image Scale
After loading the image, you need to set the scale for the axes. The program has two configuration windows for this:
- [X-axis pixel dimension]
- [Y-axis pixel dimension]
In these windows, you enter the image pixel dimensions in physical units.
For the test image, the active area for graph analysis has the following parameters:
X-axis size: 750 ms, Y-axis size: 64 µV, Image resolution: 2050×2880 pixels
Based on these parameters, the physical dimensions of one pixel are: X-axis: 0.3658537 ms Y-axis: 0.022 µV
These values are already set in the program by default. If necessary, they can be modified in lines 12 and 14 of the program.
Note: The current cursor coordinates in pixels (X, Y) are continuously displayed in the lower left corner of the loaded image panel.
4. Setting the Origin Point
Before starting digitization, you need to set the zero point (origin) that will correspond to the values X=0, Y=0. To do this:
- Click the [X0 px] button
- Click the [Y0 px] button
- On the loaded image panel, mark the origin point with the right mouse button
- Click the Clear button to clean the digitization area of accidentally selected points or any other points that don't require digitization
5. Graph Digitization Process
To digitize the graph, use the right mouse button:
- Position the cursor at the starting point of the graph
- Press and hold the right mouse button while performing an approximate manual trace along the graph line
Note: If more precise tracing is required, reduce the value of the Marker Size parameter.
6. Processing Parameters Setup
Before performing digitization, you can adjust the following parameters:
- Threshold Factor - determines the threshold for graph line recognition
- Windows size - sets the size of the moving average window
- Detrend - when enabled, removes the linear trend in the digitized graph
These parameters can be left at their default values or adjusted for specific tasks.
7. Completing Digitization
After tracing the graph:
1. Click the DIGITIZE button to perform digitization
2. Click the ADD button to save the result
8. Digitizing Multiple Graphs
To digitize the next graph:
- Click the CLEAR button
- Repeat the process starting from setting the origin point (step 4)
- Continue until all necessary graphs are digitized
9. Managing the Digitized Graphs
- Click the ADD button to add the current graph to the list of digitized graphs
- Click the REPLACE button to replace the selected graph with the current one
- Click the DELETE button to remove the selected graph from the list
10. Exporting the Digitized Data
- Click SAVE EXCEL to export the digitized data to an Excel file, or SAVE TXT to export it as a text file. Both formats will display each digitized graph in two columns, with the first column containing x-coordinates and the second containing corresponding y-coordinates. When multiple graphs are digitized, each will appear side by side, with separate x and y columns for each graph
- Click VIEW DATA to display digitized graphs in a new window with an interactive table. Select individual cells or use Ctrl+A for full selection. Right-click to copy selected data to clipboard (you can also use Ctrl+C), or export to workspace
- Click EXPORT TO WS button to transfer the data directly to the MATLAB workspace. Each digitized graph will appear as an individual variable (a1, a2, etc.), and all graphs will be combined in a structure called 'digitizedGraphs', which includes [data] (an array of all digitized graphs) and [count] (the total number of digitized graphs)

Cite As

Andrey Shapkin (2024). Graph Digitizer (https://www.mathworks.com/matlabcentral/fileexchange/167311-graph-digitizer), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2023b
Compatible with R2023a to R2024b
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.3.1

Updated program screenshot

1.3

- Fixed marker visualization to display correctly in the source image panel during initial trace operations
- Added functionality to select and copy table cells to clipboard, and export selected data to workspace

1.2

Added the [EXPORT TO WS] button, which allows exporting digitized data directly to the MATLAB workspace. Updated the program screenshot.

1.0.1

Added the EXPORT TO WS button, which allows exporting digitized data directly to the MATLAB workspace.

1.0.0