Next Previous Contents

4. Small QScanPlot tutorial

4.1 Introduction

You have to write a scientific report, an article, your Diploma Thesis, whatever... And you want to include a figure found somewhere, or rebuild an old plot. But there is a problem: you do not have the data used for that figure.

QScanPlot helps you in this case. You just have to scan the image, import it in QScanPlot, define your axes system, create your curves, and export the resulting data to an ASCII file with a format readable by your plotting tool.

As a practical example, let's assume we want to extract the data used to create the figure cr_abund.jpg (included in the directory docs). This figure shows two curves of data. The X axis is in linear scale, but the Y axis is in logarithmic scale.

4.2 Importing the image

The first thing we do is run the program QScanPlot. After the compilation, it will be located in the directory PWD/qscanplot-VERSION/qscanplot, where PWD is the directory where you extracted the package, and VERSION is the version of your copy of QScanPlot. In this directory, we run the program with:

% ./qscanplot

After showing some credits, the main window is shown.

Select, in the menu "File", the option "Import image". An dialog will be open.

Select the file (cr_abund.jpg) with figure, and press "Open". The figure will appear in the main window of QScanPlot. By default, a zoom of 50% is applied. Select "1:1 100%" in the menu "View" to make the figure bigger.

4.3 Declaring the Axes systems and the Curves

The effective creation of axes systems and curves (elements) for a given figure has three steps: first, we declare the element; second, we select it in the combo boxes appearing in the toolbar; and third, we change the pointer mode to "Axis Point" or to "Curve Point" in the menu "Elements" (or by clicking in the toolbar buttons with a blue and a red cross, respectively), and add points to the declared element by doing click in the figure. If the element is an axes system, we will be asked to enter the X and Y values that this clicked point represents in the real figure.

Declaring the Curves

Let's declare two curves and two axes systems. To declare the curve, you have three possibilitied: you can select the option "New Curve" in the menu "Elements"; you can also click in the toolbar button that shows two axis in grey and a curve in red; or, you can simply press the key "C". A new-element dialog will be shown.

You have to enter a short name for this curve, a description, and a color to be used to show the points that belong to this curve in the figure. If you, afterwards, want to change these parameters for any curve, you can select "Edit Curves" in the "Elements" menu. After creating our two curves, this last dialog offers the following information:

Declaring the Axes Systems

Let's declare now two axes systems. The first one will include a linear X axis, and a logarithmic Y axis. For some purposes, however, we could need the values in Y to be the logarithm of the actual values. Let's then declare another axes system, with again a X linear axis, but now with also a linear Y axis. Press "A" to create a new axes system. Again, a new-element dialog will be shown.

You have to enter a short name for the axes system, a description, a color to be used to show the points that define this axes system in the figure, and the scales to be assumed in X and Y axes. If you, afterwards, want to change these parameters for any curve, you can select "Edit Axes" in the "Elements" menu. After creating our two axes systems, this last dialog offers the following information (please, note that we selected "Logarithmic" for the scale of the Y axis in the first axes system).

4.4 Defining the Axes Systems

After declaring the axes systems, you have to assign a total of three points in the figure to each axes. You can leave any axes with less than three points, but it will not be usable for extracting the data from the figure.

In order to assign points to a given axes system, select it in the combo-box shown in the toolbar, and click in the button with a blue cross.

Then, you select a point in the image (best with clear coordinates in the figure). The following dialog appears.

We must enter the figure coordinates of the selected point. We select the following points for the first axes system ("AxesLog" in our example):


Point
X Coordinate Y Coordinate
top-left corner 0 1.0e5
bottom-left corner 0 1.0e-8
bottom-right corner 30 1.0e-8

For the second axes system ("AxesPwr" in our example) we select the following points:


Point
X Coordinate Y Coordinate
top-right corner 30 5
bottom-right corner 30 -8
bottom-left corner 0 -8

With these points, we have both axes systems ready to be used in any export operation.

4.5 Assigning points to the curves

The assignment of points to each declared curve is very simple. Simply select the curve in the combo-box shown in the toolbar, click on the button with a red small cross (curve point mode) and select points in the figure.

After selecting all the points, the main window of QScanPlot will look like this:

4.6 Defining grids

Grids are simple specifications of a set of fixed X coordinates without being associated to a fixed axes system. Usually, when you assign points to your curves, you will not have a sufficient resolution to catch the exact X coordinate for your point. By selecting a grid in the export process, you force to use those defined X values from your grid, and the Y values will come out from an interpolation, using your original curve points.

We defined in our sample file two grids. First, click in the grid toolbar button. The following dialog appears:

As usual, you enter a short name for your new grid, a description, the minimum and maximum values for X, and the number of intervals or the interval width. After you defined your grids, you can also select "Elements | Edit Grids" to modify the definitions. Here is the dialog that appears, after we defined our two grids.

4.7 Saving the results

It is recommended that you save your work from time to time. The first time you select "File | Save", you will be asked to select a file name. We used the name abund_qsp.xml. After pressing "Save", the data from our document will be saved in XML format.

NOTE: In the file " abund_qsp.xml" included in the distribution, the name of the image file has the form PATH/sample/cr_abund.jpg. In order to use this file, the user must first change "PATH" to the right directory name.

4.8 Give me the data!

After having all this work done, where are my data values? In order to get these, you have to "Export" your data points. First, select "File | Export Setup" or click on the Export Setup toolbar button. The following dialog will appears:

In this dialog you can select the curves you want to export, the axes system to use to convert between points in the screen and actual coordinates in the figure, the grid to use in case you need it, the criteria to use to export the data, and the format. In addition to any user-defined format that can be selected here, you can choose one of the pre-defined special formats. Just click on the tab with the label "Special Formats", and select the format you want to use.

We chose, as an example, the predefined Octave data format.

We will use the option "X values from selected Grid, Y values interpolated for all curves". In order to use this, we must select an Interpolator. To do this, select "Options | Select Interpolator". The following dialog appears:

Up to now, we only have defined three Lagrange Interpolators, of first, second and third order, extended with a simple extrapolation for the border points. Though already usable, this option is still under development.

After you choose the format suitable for your needs, you can preview the result of your export before you actually save the data to a file. Just select "File | Export Preview" or click on the Export Preview toolbar button.

If everything look like you want, select "File | Export" or press the Export toolbar button, and enter the file name.

Your data are ready to be used.


Next Previous Contents