Skip to main content

Tips and Tricks: How to Plot Experimental Data

Several calculation examples included in Thermo-Calc include experimental values to show the accuracy of the calculation. Comparing calculated data with experimental data can also be very useful in research. In this blog post, you will learn how to include your own numerical experimental data in your Thermo-Calc plots. This can also be done in the Educational Package

The image below shows an example of experimental data plotted together with calculated results in Thermo-Calc.

The topics covered in this blog post:

  • Create an .EXP file
  • Edit the .EXP file
  • Plot the .EXP file in Thermo-Calc
  • Customize the plot settings
  • Where to find more information

Create an .EXP File

To obtain graphical output of your experimental data in Thermo-Calc, you need to create an experimental file (*.EXP) using the graphical language DATAPLOT. This is done in the Console Mode of Thermo-Calc. 

  1. Open your Thermo-Calc software. If the program opens in Graphical Model, switch to Console Mode. 
  2. The experimental files are generated in the postprocessor of the POLY module. In the SYS prompt, type go poly
  3. In the POLY prompt, type save. In the Save window, navigate to the folder where you want to save your file, name your file and click Save.
    Note: This step is not always necessary but is used to avoid errors when making an EXP file without any data. Do NOT use it to make an EXP file with calculated results in the poly module.
  4. Type post to go to the postprocessor. 
  5. Define the axes variables* that you want in your plot. For example, type set-diagram-axis x THCD to set the x-axis to thermal conductivity and set-diagram-axis y T to set the y-axis to temperature.
  6. Then type plot to make the axis variables show in the Results window. 
  7. To create the experimental data file (.EXP file), type make file in the POST prompt. In the Save window, navigate to the folder where you want to save your file, name your file and click Save.

*Variables that are dependent on components or phases not present in the workspace can not be used.

Edit the .EXP File 

Now we want to edit the file you just saved. This is done in a text editor, so open your file with a text editor of your choice. In the text editor, you will see that your file is divided into a PROLOG and a DATASET.

PROLOG

The PROLOG is where plot settings are configured. Here you can set the axis limits, axis type, tick length, plot title, and axis title. Change the values to fit the data you want to plot. The axis type can be set to either linear, logarithmic, or inverse. You can use the settings in the images in this article if you don’t have your own data.

example-data-block

An example of how a PROLOG and DATASET can be written.

DATASETS and BLOCKS

The dataset contains the data you want to plot. Inside the dataset you can have different BLOCKs of data. In each BLOCK, the data is entered in tabulated form. For example,

BLOCK X=C1; Y=C2; GOC=C3, DAW;

will plot the values in column 1 on the x-axis and column 2 on the y-axis. GOC, which is short for Graphical Operations Code, determines how the coordinates are interpreted and what is done at the point determined by the coordinates. You can read more about GOC further down in this blog post. The BLOCK is where you add your data points. Below the BLOCK line is where the data points are entered. The x values, y values and GOCs are separated with a space to create different columns. When the data BLOCK is finished, type BLOCKEND to close the block.

You can have several DATASETs in the .EXP file. When you read the .EXP file in Thermo-Calc, you can choose which datasets you want to plot. After the number on the line of DATASET 1,  you can type any text you want to help identify what data is in this dataset.

Once you are done editing your file, save it again. Make sure to save it as an .EXP file.

Plot the .EXP File in Thermo-Calc

The .EXP files can be read and plotted in both Graphical Mode and Console Mode.

 

Graphical Mode

In Graphical Mode, the experimental file is opened in an Experimental File Reader. 

  1. Right-click on My Project node, hover over Create New Activity and click Experimental File Reader
  2. In the Configuration window, click on the map-button, navigate to your EXP file, and click Open
  3. Your dataset(s) is now shown below the file path. If you have several datasets, you can select which ones you want to plot. 
  4. Right-click in the Experimental File Reader node, hover over Create New Successor, and click Plot Renderer. Click Perform Now and your plot will show in the Results window.

If you make a change to the EXP file after you have read it, you need to re-read the file by using the refresh button and then click perform from the Plot Renderer node.

A screenshot showing how to open/close and save your experimental data file.

You can connect the experimental File Reader to any existing plot from a calculation. Right-click on the Plot Renderer node for your calculation, hover over Add predecessor, and click Experimental File Reader. Perform the activity again and the experimental data will show in the plot.

Console Mode

In Console Mode, the experimental file is read in the post processor of POLY Module. 

  1. Go to the POLY-3 Module: At the SYS prompt type go poly.
  2. Go to the POST module: At the POLY prompt type post.
  3. At the POST prompt, type quick or append.*
  4. Select your file and click OK
  5. Enter the Prolog and Dataset numbers you want plotted from your file (if applicable). If you want to plot more than one dataset, separate the dataset numbers with a space. 
  6. At the POST prompt, type plot.

* Use quick if you are only plotting the .EXP file. Use append if you are plotting experimental data over an existing plot from a calculation. 

Customize the Plot Settings

There are many different ways to change how your data is plotted. Only a few will be covered here, but you can find more information in the Thermo-Calc Online Help and the manuals included in your installation.

If you make changes to the EXP file after you have read it, the program can re-read the file by entering plot at the POST prompt.

Change Color and Character Size

In the DATASET, you can set the color and character size for the dataset. You can set different colors and character sizes for the different data BLOCKs by entering the new settings above the BLOCK. This image shows all the colors available:

colors_artboard-01

To see the image larger, right-click and open in a new tab.

Plot With Symbols and/or Lines

For each data BLOCK you can set the Graphical Operations Code (GOC) to customize how the data in a specific BLOCK will be plotted. You can use different symbols to mark the data points, draw a line between the data points, and change which symbols and type of line you want to use.

Here is a list of the available GOCs: 

W: World coordinates (* DEFAULT)

V: Virtual coordinates

N: Normalized plot box coordinates (NPC)

M: Move to this XY (*)

D: Draw to this XY

A: XY is absolute values  (*)

R: XY are relative values

S: Plot current symbol at XY (add a number to indicate which symbol to use)

B: Apply soft spines on the drawn curve

‘: Plot the following text at XY


Plot the Data with Only Symbols 

You can plot your data in different ways. For example,

BLOCK X=C1; Y=C2; GOC=C3, MAWS1;

will plot symbol 1 at each datapoint if no other GOC is entered in column 3 in this BLOCK. The column number (GOC=C3) is the location of any possible GOC codes in the current data BLOCK, while MAWS1 is the default GOC for this data BLOCK. This means that you can change the GOC for a specific data point by simply writing the new GOC in column 3. For example, you can use different symbols for different data points.

Use DATAPLOT code to change symbols in the plot

All available symbols are shown in this image:

symbols_artboards_02-01

To see the image larger, right-click and open in a new tab.

You can have several data BLOCKs in each DATASET. Add a new data BLOCK the same procedure as for the first one. You can change the appearance of this data block to separate the two by using a different GOC. For example, you can use different symbols or linetypes. 

Draw a Line Between Data Points

If you want to draw a line between your data points, you can change the GOC from MAWS1 to DAWS1. And if you don’t want to have any symbol for this data, you can remove S1 from the GOC.

DATAPLOT code for ploting experimental data with lines

You can use different linetypes to differentiate between the different data. For example, you could use a solid line for one dataset and a dashed line for another dataset. The default linetype is a solid line (linetype 1). The linetype is entered above the BLOCK line.

DATAPLOT commands to plot experimental data with different line types

Add Legend

To describe what the different symbols and lines are showing, you can add a legend to your plot. To add a legend to your plot, you need to specify what you want the legend to say, how you want it to look, and where in the plot you want the text to go. The following information is entered within a DATASET above the BLOCK line:

  1. Enter the coordinates of where you want the legend to show. This is entered with coordinates between 0 and 1. For example, the coordinates 0.05  0.95 will place the legend in the upper left corner. 
  2. On the same line, enter the GOC you want to use. Here you should use N instead of W to use normalized plot box coordinates.
  3. Directly after the GOC, add ‘ and write the text you want to show.

You can also use Latex commands if you, for example, want to use a greek letter to describe a phase. 

DATAPLOT code to add legend to the experimental data plot

Where to Find More Information

The information in this blog post shows only a few examples of what you can do with your experimental file plot. There are many ways in which you can adjust the plot to your liking or needs. More in-depth information can be found by searching for DATAPLOT in the Online Help or the Thermo-Calc Documentation Set included in your Thermo-Calc installation. You find these resources under the Help menu within the software.

 

This article is a part of a blog series of tips and tricks to help users get the most out of Thermo-Calc. Read the other blog posts in the series by clicking the button below.

Let Us Help You

Is Thermo-Calc Right for You?

Talk to one of our experts to learn whether our tools fit your needs.