Skip to content

GraphScan

Liam edited this page Aug 6, 2024 · 2 revisions

The GraphScan class is for inferring numerical data from graphical figures, and directly linking the datasets to the parameters input using the Bibliography class.

The example shown uses data from D. Cheng et al,. Carbon 154, 58, (2019): 10.1016/j.carbon.2019.07.094

To use the GraphScan GUI in a Jupyter notebook, first follow the instructions to enter the article details using the Bibliography GUI. Copy the GraphScan.py file to the same directory as your Jupyter notebook, and use:

from GraphScan import GraphScan
gs = GraphScan()
gs.tab

Load data

The GraphScan GUI can be used to create new data, or re-load previously-entered data. Previously entered data for each graph image is stored in a series of numpy files in a subdirectory with the same name as the corresponding image.

image

Figure 6: GraphScan interface, showing the 'Load data' tab

Axis limits

The image is loaded as an array, with its scales corresponding to pixels. To link the pixel size to the measured values, the user enters the minimum and maximum x and y values displayed on the graph (Fig. 7a).

In general: where the graph is inside a solid box, the solid axes are continuous throughout their corresponding row/ column. As shown here, summation of the RGB array over rows/ columns identifies the axes as sharp inflection points.

image

Figure 7a: GraphScan interface, showing axis limit entry

In exceptional cases: where the graph does not have upper and right axes (Fig 7b) or a graph feature is parallel to the upper axis (Fig S7 d), the method shown here fails. Here, the ‘manually select area’ button in the GUI may be used, with the user clicking and dragging to select the graph area corresponding to the entered axis limits. After clicking confirm, these axis limits and identified edges are applied to the image (see Fig 8).

image

b

image

c

Figure 7: Examples of images where automatic axis identification method fails. b) Graph without upper and right bounding box, from H. Köse, et al (10.1016/j.synthmet.2020.116471) , c) graph with black horizontal data (here, Coulombic efficiency) from G. Li, et al 10.1038/ncomms10601).

Line data

The data series and their corresponding C rates are entered in the accordion. The line colour can be chosen from a grid, or selected from the graph image using the colour-match tool (depending on Matplolib version). The ‘plot name’ is for the user’s reference to enable association of data series with host matrix labels.

image

Figure 8a: GraphScan interface, showing the 'Line data' tab for multiple data series

Fig. 8b shows an example of partially-entered data for multiple C rates in a sequence.

image

Figure 8b: Entering a sequence of different C rates for a single data series (truncated at 6 entries for clarity of display).

Setting masks

The numerical values of data points are inferred by matching each data series using the RGB values in the image (see here for schematic illustration, see here for example with monochromatic data). Where there are graph features with the same colour as data series, but which are not part of the data series (including legend entries, corresponding Coulombic efficiency data, detail insets) these can be selected by the user and removed using ‘masks’ so that only the data series remain. As shown in Fig. 9, multiple overlapping masks can be used if needed to cover non-rectangular areas. The ‘masked’ version of this image is shown in Fig. 10.

image

Figure 9 GraphScan interface showing the ‘Setting masks’ tab. New masks are set by clicking and dragging around the required area. Here, masks have been ‘confirmed’ in the upper portion of the image (translucent red), and a new mask has been added at the bottom (solid blue). On clicking ‘confirm current’, the blue area will show as translucent red.

Scan graph

The data series entered in step 8 can be associated with the host matrix names entered in step 3 using drop-down lists of the available names, shown in Fig. 10. On clicking ‘display graph’ candidate fits are displayed overlaid on the graph image, and tools for adjusting the ‘margin’ and ‘tolerance’ appear below the interface.

General case: multicoloured graphs

image Figure 10a: GraphScan interface showing the ‘Scan graph’ tab. The drop-down lists are used to link the data series with the parameters from the Bibliography interface.

image

Figure 10b: Interpolated data overlaid on graph image in blue, orange, and green. After clicking ‘Display graph’, the ‘tolerance’ and ‘set margin’ options appear: see here for interpretation.

Special case: monochrome graphs

The drop downs should be used to select the data as they appear from top to bottom of the graph (highest capacity to lowest capacity) (see here for more information).

Clone this wiki locally