Live Chat

All Issues

Golden Software Newsletter

Our newsletters are filled with interesting technical tips, news of how people are using Surfer, Grapher, Voxler, MapViewer, Didger and Strater, and (of course!) great illustrations.

Subscribe to Our Newsletter

...

Issue 62

Exporting Fit Curves and Resampling

Grapher™ 8 and Didger® 4: Exporting Fit Curves and Resampling

Grapher 8 has the ability to add a fit curve to any line/scatter plot. This can be useful for displaying trends or for filling in gaps in data. Once the fit curve is displayed in the desired form, you can export the fit curve to a new data file. This data file can be imported into Didger, Golden Software's digitizing and georeferencing program, and resampled to any desired interval.

This article discusses creating a scatter plot, adding a fit curve, and exporting the fit curve data in Grapher. Also discussed is information about importing the file into Didger and resampling the curve to a specific interval. This data is then saved to a new DAT file for future use.

Creating a Scatter Plot

Line/scatter plots are created from two columns of data. The line that connects the points is plotted in the same order that the data appears in the worksheet. So, it is important to have the data sorted before creating the graph. The data set used for this newsletter can be downloaded from here. To create a line/scatter plot from this data, follow these steps:

  1. Choose Graph | 2D XY Graphs | Line/Scatter.
  2. Select the data file and click Open.
  3. To display only scattered points of the data with no line, choose Graph | Change Plot To | Scatter.
  4. If desired, click on the Symbol tab in the property inspector window to change the symbol to another shape. Click the + next to the Symbol command and select a new shape, such as a filled circle. The graph automatically updates.
Scatter Plot
A scatter plot displays the actual data values
of each point in the worksheet.

Adding a Fit Curve

To add a fit curve to the plot, click once on the scatter plot to select it. In the property inspector,

  1. Open the Plot tab.
  2. Next to the Fits command, click the <Click here to add/edit fits> text. The Fits dialog opens.
  3. Select the desired fit, such as a Spline smoothing fit and click the Add button.
  4. Multiple fit curves can be added by selecting another fit curve type, such as a Linear fit and clicking the Add button.
  5. Click the OK button. The graph is automatically updated to display the fit curves.

 

Scatter Plot and Fit Curves
A scatter plot with two fit curves showing trends between the points.

Exporting the Fit Curve to a Data File

Once the fit curve is displayed on the graph, it can be selected and edited. For instance, if you click on the Line tab, you can change the Color. This is useful when you have multiple curves displayed. In this graph, there are three plots: a scatter plot, a spline smoothing fit curve, and a linear fit curve. A legend has been added to the graph using the Graph | Add to Graph | Legend command to distinguish each curve.

 

Scatter Plot with Legend
A legend easily determines which data each curve is displaying.

With the legend, we can easily see that the red curve is the spline smoothing curve while the blue curve is the linear fit curve. To export the spline smoothing fit curve data,

  1. Click on the red curve to select it.

     

    Object Manager
    Select the Spline smoothing
    fit curve in the object manager.

     

  2. Choose the Graph | Export Plot Data command. A new worksheet opens.

Note the X values in column A. These values are not on an even interval. Instead, the numbers are spaced so that the fit curve is approximated in the data. By default, a fit curve has 200 points. Since this data was created from a default fit curve, it should have approximately 200 points.

  1. Scroll down to the last cell in the worksheet. You can quickly do this by pressing CTRL+END on the keyboard.
  2. Note the last row number that contains data.

     

    View Worksheet
    Confirm the last row number with data.

     

  3. Scroll back to the top of the worksheet. You can quickly do this by pressing CTRL+HOME on the keyboard.
  4. In cell A1, type in the one less than the last row number. In this case, you can type in 200. This is the number of points that are in the file.
  5. In cell B1, type in the number 1. This is a flag for Didger when importing the file.
  6. Choose File | Save As. Type in a File name, such as fitdata. Change the Save as type to BLN Golden Software Blanking (*.bln). Click the Save button. The file is saved.

Importing and Altering the Fit Curve in Didger

Golden Software's Didger program allows manipulation of digitized data, as well as images, and data files. After opening Didger,

  1. Choose the File | Import command. Select the BLN file created in step 13 and click the Open button.
  2. In the Define Import Options dialog, ensure that Cartesian Coordinates is selected and click the OK button. The line appears.

 

Define Import Options dialog
Set the Coordinate Space Type to Cartesian Coordinates.

The line can be altered in many ways. One way to alter the line is to resample it. Resampling takes the original point values and alters them. This can be so that one value is evenly incremented or so that only a certain number of values are generated. In this example, we want to evenly increment the X values.

  1. Click on the line to select it.
  2. Choose the Tools | Resample Polyline command.
  3. In the Resample Polyline dialog, select Resample Along X Axis.
  4. Change the Increment Value to 1 so that a new point is generated at each integer X value.
  5. Uncheck the Create new line as only a single line is desired.

     

    Resample Polyline
    Resample the polyline to obtain evenly spaced data.

     

  6. Click the OK button. The curve is altered so that the data is only along the X values.
  7. Choose File | Export to create a new data file from the evenly spaced data. Type in a File name, such as exportedfitdata. Change the Save as type to DAT - Golden Software Data (*.dat). Click the Save button.
  8. In the Export Options dialog, select Separate objects with and type a comma in the box. Click the OK button to create the file.

Verifying the Data

In Grapher, you can choose the Graph | Add to Graph | Plot command to add a line/scatter plot to the existing graph. The new curve will overlay the fit curve almost exactly. If you open the data file, the X values are evenly spaced.

 

View Exported Data
View the resampled data to ensure
it is evenly spaced, as desired.
Prev Next

Great products at reasonable prices. John Miller Chief Geologist

ARC Resources Ltd

Thanks To Golden Group and her smart and genius technical team. Keeps doing innovations. We’re following you. Ahmet E. Mengen

Keep up the good work with your ingenious, efficient, functional and cost effective software products. Dr. Lazaros Polymenakos Consultant Geologist-Geophysicist

geotomi consulting, Greece

Trusted by over 10,000 Companies and Schools

  • logo-Hafer.png
  • logo-Unistmo.png
  • logo-Xenon_Geosciences.png
  • logo-Archeodata.png
  • logo-Neogeo.png
  • logo-Laguna_Geosciences.png
  • logo-Basin_Wells_Associates.png
  • logo-ACHM.png
  • logo-SEI.png
  • logo-UJV.png
  • logo-Golder_Associates.png
  • logo-marshallinger.png
  • logo-Parsons_Brinckerhoff.png
  • logo-Park.png
  • logo-Xenon_Geosciences.png
  • logo-SES.png
  • logo-CB_Magneto.png
  • logo-LFV_Hydroakustik.png
  • logo-Rison.png
  • logo-The_Bodhi_Group.png

From Our Blog

Golden Software Annual Meeting, 30th Anniversary Year
b2ap3_thumbnail_GSI.png
At the end of April, Golden Software once again held its annual meeting. Programmers and tech support alike flocked to Golden from as far away as Turkey, New York, Washington, and California in order to discuss the future of the company and brainstor... Read More

Subscribe to Our Newsletter

...

Announcement

Surfer 11 Webinar

Surfer’s product manager, Kari Dickenson, will host a webinar on Surfer 11's Frequently Asked Questions.

Tuesday, June 25th
8:30am MT

Thursday, June 27th
2:00pm MT

Register today!