Error bars and overlaying plots example
The first part of this example uses summary statistics and error bars to create two XY plots, one using relative error bars and the other using absolute error bars. Next, plot overlays are created to help with data comparison.
The completed project (Plots.phxproj) is available for reference in …\Examples\Data and Plots.
Note: There may be multiple paths to accomplishing a step (e.g., main menu, right-click menu, drag-and-drop, etc.). For simplicity, only one is listed here.
Set up the project
Create a new project called Plots.
Import the file …\Examples\WinNonlin\Supporting files\Bguide2.dat.
Press Finish in the Import File Wizard.
Units must be added to the time and concentration columns before the dataset can be used to create plots.
In the Columns tab, below the Bguide2 worksheet, select Time in the Columns box.
Clear the Unit field and type hr.
Select Conc in the Columns box.
Clear the Unit field and type ng/mL.
Or click the Units Builder button and use the Units Builder dialog tools.
Note: Units added to ASCII datasets can be preserved when the datasets are exported to disk or a database. Phoenix adds the units to a row beneath the column headers. When importing a .dat or .csv file with units, select the Has units row option in the Options area in the File Import Wizard dialog.
Set up the Descriptive Statistics object
To create error data for the error bars, this example computes means and standard deviations for the concentration data at each time point.
1. Right-click Bguide2 in the Data folder and select Send To > Computation Tools > Descriptive Statistics.
2. Map the data types as follows:
Sex to None.
Subject to None.
Time to Sort.
Conc to Summary.
3. In the Options tab, check the Confidence Intervals and Number of SD Statistics boxes but do not change the default values for these two items.
4. Click (Execute icon) to execute the object.
Plot the mean +/- standard deviation using relative error bars
1. Right-click the Statistics worksheet in the Results tab and select Send To > Plotting > XY Plot.
2. Map the data types to the following contexts:
Time to X.
Mean to Y.
SD to Lower and Upper Error Bars.
Leave all other data types mapped to None.
3. In the Options tab, click the Title sub-tab and type: Mean +/- Standard Deviation in the Title field.
4. Select Graphs > Mean vs Time > Error Bars in the Options tab list.
User is the default Error Calculation Type and Relative is the default User Calculation Type. Do not change these settings. The Relative calculation will add and subtract the errors from the mean.
5. Execute the object.
Plot the median, minimum, and maximum using absolute error bars
1. Right-click Workflow in the Object Browser and select the New > Plotting > XY Plot menu item.
2. In the Mappings panel for XY Plot 1, click (Select Source icon) to open the Select Source dialog.
3. Select the Descriptive Statistics object’s Statistics worksheet and press OK.
4. Map the data types as follows:
Time to X.
Median to Y.
Min to Lower Error Bar.
Max to Upper Error Bar.
Leave all other data types mapped to None.
5. In the Options tab, click the Title sub-tab and type: Minimum, Median, and Maximum Concentrations.
6. Select Graphs > Median vs Time > Error Bars.
7. In the User Calculation Type menu select Absolute.
Using the Absolute calculation plots the Min and Max values on the Y axis, rather than to add and subtract them from the Median.
8. Execute the object.
Overlay multiple plots using variables from the same dataset
This example overlays data from separate columns in the same workbook.
1. Right-click Workflow in the Object Browser and select New > Plotting > XY Plot.
2. In the Mappings panel for XY Plot 2, click .
3. Select the Descriptive Statistic’s Statistics worksheet and press OK.
4. Map the data types as follows:
Time to X.
CI 95% Lower Mean to Y.
CI 95% Upper Mean to Y2.
Leave all other data types mapped to None.
5. In the Options tab, click the Title sub-tab and type: Overlay Charts. Press ENTER to move to the next line and type: Example 1.
6. Select Plot > Layout.
7. Set the Legend Area Size field to 200.
8. Select Axes > Y and then the Axis Label sub-tab.
9. In the field type Confidence Interval and click to center the text, if needed.
10. Execute the object.
Note: If the data are stored in one column, it is also possible to create similar plots, without using the overlay feature, by assigning a variable or parameter to the Group context.
Overlay variables from multiple datasets
This part of the example plots the Observed and Predicted concentrations from a model fitting by using the exported output files from a PK Model object in a different project.
1. Import …\Examples\Data and Plots\Supporting files\bg1 Sheet1.dat and Summary Table.dat.
Press the arrow button and then press Finish in the File Import Wizard dialog.
2. Right-click bg1 Sheet1 in the Data folder and select Send To > Plotting > XY Plot.
3. Map the data types as follows:
Subject to None.
Time to X.
Conc to Y.
4. Select the Plot > Graphs sub-tab.
5. Click Add.
A second XY Plot input named XY 1 Data is added to the Setup list.
6. Select XY 1 Data in the Setup list.
7. In the Data Mappings panel click .
8. In the dialog, select Summary Table worksheet and press OK.
9. Map the data types as follows:
Time to X.
Predicted to Y.
Leave all other data types mapped to None.
10. In the Options tab, click the Title sub-tab and type: Overlay Charts 2
Press Enter to move to the next line and type: Example using two datasets
11. Select Graphs > Conc vs Time in the tree.
12. Select the Appearance tab.
13. Use the Marker Color menu to change the marker color to Red.
14. Execute the object.
15. Right-click the project and select Close Project.
This concludes the Error Bars and Overlaying Plots example.
Legal Notice | Contact Certara
© Certara USA, Inc. All rights reserved.