5.5. Plotting Using the Workflow Engine

It’s also possible to use the workflow engine to build graphical plots.  If you don’t know how to use the workflow engine, see this section for a crash course tutorial.

This section assumes you have a tabular data file generated from the rosen_multidim Dakota study.

To begin, click File > New > Other, then Workflow > Workflow.  Call your workflow “ScatterPlot.iwf.”

Drag your tabular output file from the project navigator view onto the workflow canvas.

Plotting_Workflow_1.PNG

Next, drag two “column” nodes (from the Arrays folder) onto the canvas node.  Column nodes can extract single columns from tabular data files.

Plotting_Workflow_2.PNG

Configure each column node to pull a different column from the tabular data file.  For the first one, we will set its “columnIndex” property to 3 (should correspond to the “x1” column) and its “headerLines” property to 1 (disregard the first row of the tabular data file, since it represents column labels).  For the second one, we will set its “columnIndex” property to 5 (should correspond to the “response_fn_1” column) and its “headerLines” property to 1 as well.

Then, draw two connector lines from the file node’s “dataOut” port to both column nodes’ “stdin” ports.

Plotting_Workflow_3.png

Now, open the Chartreuse folder in the Palette and drag “traceScatterPlot2d” onto the canvas.  Note that it has two input ports – “X” and “Y.”  We will drag connectors from our two column nodes’ “stdout” ports to these two input ports.

Plotting_Workflow_4.PNG

If you open the Settings editor view for the traceScatterPlot2d, you will notice that many of the same configuration settings for 2D scatter plots that were available in the Plot Trace Creator dialog are available here as well:

Plotting_Workflow_5.PNG

Let’s go ahead and try running this workflow.  Click the rightmost play button.  You should see the plot appear in the usual Plot View canvas:

Plotting_Workflow_6.png

If you want to save this plot to a file (like we did in the previous plotting tutorials), use the “plotFile” output port available on each plotting node to pipe the plot data to a file node.

Multiple Traces

Let’s make this plot more interesting and add another trace to the same canvas.

  • Add a third column node to this workflow.  Configure it to extract the “x2” column from our tabular data file (the fourth column).  Don’t forget to set headerLines to 1 to omit the first row.
  • Connect the tabular data file node’s dataOut port to this new column node’s stdin port.
  • You may want to consider using each column node’s label field to keep the column nodes straight.
  • Add a second traceScatterPlot2d node.  Set its Trace Color property to something other than black.
  • Wire the x2 column’s output port to this trace node’s input X port, and the response_fn_1 column node’s output port to this node’s input Y port.

Plotting_Workflow_7.PNG

If you hit the play button at this point, you’ll notice that one of the two traces will display in the Plot view first, and then the second one will come and overwrite it, removing the first trace from view.  This isn’t what we want!  To resolve this, use a plotCanvas node from the Chartreuse folder.  Create two new input ports for this node, and draw connector lines from our two trace nodes’ trace output ports to the two input ports you just created:

Plotting_Workflow_8.PNG

The plotCanvas node supports an arbitrary number of user-created input ports to accumulate traces onto the same canvas.  Also, the plotCanvas settings editor view allows you to relabel that canvas’s axis labels, turn the grid on and off, and more. (These are the same controls made available in the canvas section of the Plot Manager dialog).

Hit the play button on this workflow now.  We get the expected plot where two traces are overlaid over each other on the same canvas:

Plotting_Workflow_9.PNG

Multiple Canvases

Now let’s try separating these two plot traces onto their own canvases.  Because we will be dealing with multiple canvases (and therefore multiple plotCanvas nodes) we will need a new type of node to aggregate canvases together – the plotWindow node.

  • Add a new plotCanvas node and a new plotWindow node to your workflow.
  • Pipe the second traceScatterPlot2d node’s trace output port to the new plotCanvas node.
  • Delete the second traceScatterPlot2d node’s original pipe to the first plotCanvas node, and make sure to delete the first plotCanvas node’s second input port.
  • Then, on the new plotWindow node, add two custom input ports (for instance, “canvas1” and “canvas2”) and pipe your two canvas output ports to these two input ports.
  • Also, make sure to set the plotWindow node’s “Column count” field to “2” – this will ensure that the two canvases are stacked horizontally next to each other.  If you wanted to stack the two canvases vertically, you would set the “Column count” field to 1 (that is, if you think about the canvases being on a grid, there would only be one column of canvases, so when the second canvas needs to be placed, it will move down to the next row).

When you’re done, your workflow should look something like this:

Plotting_Workflow_10.PNG

Hitting the play button will produce the following:

Plotting_Workflow_11.PNG