# Create Plots

In the Weibull++ data set and ALTA data set tutorials, you learned how to use the Synthesis API to analyze a data set and obtain calculated results. In this tutorial, you'll use the Synthesis API to generate a plot of the results.

Note that this tutorial is for demonstration purposes only; it doesn't take efficiency into account and doesn't include any exception handling.

## Prerequisites

This tutorial uses a Windows Form application that displays a plot at a click of a button. Before you begin, please create a Windows Form Application project, and add a Button and PictureBox control to the form.

Need help with creating Windows Forms? See this Microsoft tutorial.

## Tutorial: Create a Probability Plot

The following example demonstrates how to use the Synthesis API to create a Weibull++ probability plot and display it in a Windows application. To run this example, copy and paste the code below to the Button Click event handler in your project. A discussion of the example follows.

The VBA version of the code sample is available here.

VB.NET

Imports SynthesisAPI

Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

'Create a Weibull++ data set.
Dim WDS As New WeibullDataSet

'Analyze the data set using the 2-parameter Weibull distribution and
'the RRX analysis method. Keep all other analysis settings at default.
WDS.AnalysisSettings.Distribution = WeibullSolverDistribution.Weibull
WDS.AnalysisSettings.Parameters = WeibullSolverNumParameters.MS_2Parameter
WDS.AnalysisSettings.Analysis = WeibullSolverMethod.RRX

'Analyze the data set.
WDS.Calculate()

'Declare a new WAPlots object.
Dim WPlot As New WAPlots

'Add the analyzed data set to the plot.

'Create a probability plot and display it in the PictureBox.
PictureBox1.Image = WPlot.CreatePlot(WAPlotType.Probability)
PictureBox1.SizeMode = PictureBoxSizeMode.AutoSize

End Sub
End Class


### Discussion

You'll first need an analyzed Weibull++ or ALTA data set before you can create a plot. The first three sections of code in this example demonstrate how to create and analyze a simple Weibull++ data set (for a full discussion, see this tutorial). From this data set, we'll create a plot.

  'Create a Weibull++ data set.
Dim WDS As New WeibullDataSet

'Analyze the data set using the 2-parameter Weibull distribution and
'the RRX analysis method. Keep all other analysis settings at default.
WDS.AnalysisSettings.Distribution = WeibullSolverDistribution.Weibull
WDS.AnalysisSettings.Parameters = WeibullSolverNumParameters.MS_2Parameter
WDS.AnalysisSettings.Analysis = WeibullSolverMethod.RRX

'Analyze the data set.
WDS.Calculate()


Create a new WAPlots object to represent the plot and then use the AddDataset method to assign the data set to the plot.

  'Declare a new WAPlots object.
Dim WPlot As New WAPlots

'Add the analyzed data set to the plot.

To display the plot, assign it to the Image property of the PictureBox. The SizeMode property is optional; it resizes the PictureBox to fit the image.
 'Create a probability plot and display it in the PictureBox.