Subscribe Bookmark RSS Feed

JSL to change color of specific cause in Pareto Plot

snagpal

Community Trekker

Joined:

Mar 14, 2016

Hello,

I'm trying to change the color of a specific cause in the Pareto Plot using JSL.  How can I select a cause by name?

For example, I want to implement something like this:

cause ({"PASS"}) << Colors (Green);

This gives me an error and wants me to use Cause where n is the index of the failure pareto.  My issue is that I won't know if my PASS pareto will be #1, #2, etc.

Any suggestions?

Here is my code below:

dt << Pareto Plot(

  Cause( :BinName),

  Colors (Red),

  SendToReport(

  Dispatch( {}, "Pareto Plot", OutlineBox, {Set Title( "Pareto of " || (dt << Get Name) )} ),

  Dispatch( {"Plots"}, "102", ScaleBox, {Label Row( Show Major Grid( 1 ) )} )

  )

  )

Shin

2 REPLIES
Wendy_Murphrey

Joined:

Jun 23, 2011

Hi, Shin.

The following example demonstrates how you can determine the index and color a specific cause by name:

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/Quality Control/Failure Raw Data.jmp" );

/* Obtain the sorted frequency */

dtSumm = dt << Summary( Group( :failure ), private );

dtSumm << Sort( By( :N Rows ), Order( Descending ), Replace Table );

/* Obtain the row number for the desired cause specified by name */

r = (dtSumm << Get Rows Where( :Failure == "oxide defect" ))[1];

/* Generate the Pareto Plot */

pPlot = dt << Pareto Plot(

      Cause( :Failure ),

      Colors( "Red" ),

          /* Set the color for the desired cause */

      Cause[r] << Colors( "Green" ),

      SendToReport(

              Dispatch(

                    {},

                                    "Pareto Plot",

                    OutlineBox,

                    {Set Title( "Pareto of " || (dt << Get Name) )}

              ),

              Dispatch( {"Plots"}, "102", ScaleBox, {Label Row( Show Major Grid( 1 ) )} )

      )

);


I hope this helps.


Wendy​

Wendy
snagpal

Community Trekker

Joined:

Mar 14, 2016

Hi Wendy,

That was perfect.  Thanks for  the solution.

Shin