I am trying to write a script to automate the creation of a Bivariate graph. Below is an example of my data:
I created the Bivariate output I wanted using the point-and-click method:
- assigning column OD to the Y response, column Assigned Cal for the X response, and column Lot for the By role
- right-click on the red triangle, click Group By, selecting column Condition
- right-click on the red triangle, click Fit Special, selecting 2 Quadratic from the dropdown and unchecking Centered Polynomial
and the resulting graph is what I want:
The resulting script from making this via the point-and-click method is as follows:
platform = Data Table (dt3) <<
Bivariate(
Y( :OD ),
X( :"Assigned Cal"n ),
Fit Where(
:Condition == "Vendor 4",
Fit Special(
Degree( 2 ),
Centered Polynomial( 0 ),
{Line Color( {212, 73, 88} )}
)
),
Fit Where(
:Condition == "Vendor 1",
Fit Special(
Degree( 2 ),
Centered Polynomial( 0 ),
{Line Color( {61, 174, 70} )}
)
),
Fit Where(
:Condition == "Vendor 2",
Fit Special(
Degree( 2 ),
Centered Polynomial( 0 ),
{Line Color( {66, 112, 221} )}
)
),
Fit Where(
:Condition == "Vendor 3",
Fit Special(
Degree( 2 ),
Centered Polynomial( 0 ),
{Line Color( {204, 121, 41} )}
)
),
By( :Lot )
);
This is well and good, but in my example I had 4 unique Condition values (Vendor 1, Vendor 2, Vendor 3, Vendor 4). When my coworkers use this script, their data may have a different number of conditions (2 or more) and their condition names may be different. In the script above, the 4 unique Condition values are referred to specifically, colors are assigned specifically, etc.
So my question is: how can I write a general script for this process that will do the same actions for n unique Condition values with various names?