Subscribe Bookmark RSS Feed

Script to assign Row states to unique Columns values

Nalla

Occasional Contributor

Joined:

Feb 3, 2017

Hi Everyone!

 

Am new to JSL and would appreciate any help on this.

 

On my overall script, I have already done bivariate box plots of various parameters comparing different machine groups, which is the x-axis.

What I'd like to do next is assign colors to markers in the boxplot of each machine groups. ie, Machine A = green, Machine B = red, Machine C = yellow, Machine D = blue.

I don't prefer to use the function of "group by" to assign legends as it would entail additional space for Legends on my graph.

My idea to script this is to determine the unique groups(Machines) in the "Machine" column and assign colors for the unique values in this column by row selection and assign row state colors.

My data set can vary weekly and have different number of Machines being analyzed. So I'd like to automate the process of assigning marker colors for each Machine for my boxplot. Pls refer to the graph below. Thanks.

 

Capture.PNG

 

1 ACCEPTED SOLUTION

Accepted Solutions
markbailey

Staff

Joined:

Jun 23, 2011

Solution

From Help > Books > Scripting Guide:

Assign Colors and Markers to Rows

You can use the Colors and Markers messages to assign (or change) colors and markers used for rows. These settings mostly affect graphs produced from the data table. Both messages expect numeric arguments to choose which color or marker to use. For details about how numbers correspond to colors and markers, see “Colors and Markers” on page 367.

dt << Colors( 3 ); // set selected rows to red
dt << Markers( 2 ); // pick the X marker for selected rows

As with other row messages, you can stack selection and other messages together, as follows:

dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
dt <<
Select Where( :age == 13 ); // select the youngest subjects

<< Colors( 8 ) << Markers( 8 ); // and use purple open circles for them Color by Column sets colors according to the values of a column that you specify, and Marker

by Column works similarly:

dt = Open( "$SAMPLE_DATA\Big Class.jmp" ); dt << Color by Column( :age );
dt <<
Marker by Column( :age );

Additional, named arguments are as follows:

  • Continuous Scale (Color by Column only) Assigns colors in a chromatic sequential fashion based on the values in the highlighted column.

  • Reverse Scale Reverses the color scheme in use.

  • Make Window with Legend Creates a separate window with a legend.

  • Excluded Rows Applies the row states to excluded columns.

  • Marker Theme Specifies the marker type.

  • Color Theme Specifies the color theme.

Learn it once, use it forever!
2 REPLIES
markbailey

Staff

Joined:

Jun 23, 2011

Solution

From Help > Books > Scripting Guide:

Assign Colors and Markers to Rows

You can use the Colors and Markers messages to assign (or change) colors and markers used for rows. These settings mostly affect graphs produced from the data table. Both messages expect numeric arguments to choose which color or marker to use. For details about how numbers correspond to colors and markers, see “Colors and Markers” on page 367.

dt << Colors( 3 ); // set selected rows to red
dt << Markers( 2 ); // pick the X marker for selected rows

As with other row messages, you can stack selection and other messages together, as follows:

dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
dt <<
Select Where( :age == 13 ); // select the youngest subjects

<< Colors( 8 ) << Markers( 8 ); // and use purple open circles for them Color by Column sets colors according to the values of a column that you specify, and Marker

by Column works similarly:

dt = Open( "$SAMPLE_DATA\Big Class.jmp" ); dt << Color by Column( :age );
dt <<
Marker by Column( :age );

Additional, named arguments are as follows:

  • Continuous Scale (Color by Column only) Assigns colors in a chromatic sequential fashion based on the values in the highlighted column.

  • Reverse Scale Reverses the color scheme in use.

  • Make Window with Legend Creates a separate window with a legend.

  • Excluded Rows Applies the row states to excluded columns.

  • Marker Theme Specifies the marker type.

  • Color Theme Specifies the color theme.

Learn it once, use it forever!
Nalla

Occasional Contributor

Joined:

Feb 3, 2017

Thank you. It worked.