Subscribe Bookmark RSS Feed

JMP CDF Plots

qt

Community Trekker

Joined:

Oct 17, 2012

When I used JMP to plot CDF plot, I can right-click, and then customize the line style (solid, dashed, etc.), change line thickness, change line color, etc. But those changes seems not included in the 'Script'. When I copy and paste the script, it just the standard CDF plot. How could I change the CDF lines' color/style/thickness using JMP script?

Thanks,

Qian

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

I can't find a way to address individual lines in the CDF plot by JSL. An alternative is to create the plot from scratch which would give you much more control of the appearance.

Here's an example based on the Big Class.jmp sample data:

Names Default To Here( 1 );

dt1 = Open( "$SAMPLE_DATA/Big Class.jmp" ) << Split(

  Split By( :age ),

  Split( :height ),

  Remaining Columns( Drop All )

);

Y = dt1 << get as matrix;

colors = {"red", "blue", "green", "yellow", "black", "red"};

sizes = {1, 2, 1, 2, 3, 5};

styles = {"Solid", "Solid", "Dotted", "Dashed", "DashDot", "DashDotDot"};

// Draw empirical CDF

New Window( "Empirical CDF",

  Graph Box(

  X Scale( min(Y)-1, max(Y)+1 ),

  Y Scale( -0.0, 1.1 ),

  For( j = 1, j <= N Col( Y ), j++,

  {Quant, CumProb} = CDF( Y[0, j] ); // CDF function

  Pen Color( Eval( colors[j] ) );

  Pen Size( Eval( sizes[j] ) );

  Line Style( styles[j] );

  For( i = 2, i <= N Row( Quant ), i++,

  H Line( Quant[i - 1], Quant[i], CumProb[i] );

  V Line( Quant[i - 1], CumProb[i - 1], CumProb[i] );

  )

  )

  )

);


5 REPLIES
mattflynn

Community Trekker

Joined:

Oct 16, 2012

Hello:

Easier than you think:

e.g. insert:

Pen Color( "red" );

Pen Size( 3 );

Y Function(

     F Distribution( q, dfn, dfd );

...

see also:

/Help, Scripting Index, Display, Graph Box command for a Pen Color example.

best regards,

-Matt

qt

Community Trekker

Joined:

Oct 17, 2012

Thanks.

I give it a try and get similar plots.

I have data column 'Res' (Y) and another category column 'Test_ID' (X). 'Test_ID' can be 'A', 'B', 'C', 'D', 'E'. By default JMP assign them different colors.

What I want to do is to make CDF plot Line 'C', thicker, Line 'E', a dashed line. I can right-click on each plot to customize them, while since I have many plots, and want to make similar changes, so I am wondering whether I can do it in script.

Here is my script:

=======================================

Pen Color( "red" );

Pen Size( 5 );

Oneway(

    Y( :Res ),

    X( :Test_ID),

    CDF Plot( 1 ),

    SendToReport(

        Dispatch(

            {},

            "1",

            ScaleBox,

            {Min( 10), Max( 14 ), Inc( 0.5 ), Minor Ticks( 1 ),

            Show Major Grid( 1 ), Show Minor Grid( 1 ),

            Rotated Labels( "Horizontal" )}

        ),

        Dispatch(

            {"CDF Plot"},

            "1",

            ScaleBox,

            {Min( 10 ), Max( 14 ), Inc( 0.5 ), Minor Ticks( 1 ),

            Show Major Grid( 1 ), Show Minor Grid( 1 ),

            Rotated Labels( "Horizontal" )}

        ),

        Dispatch( {"CDF Plot"}, "Oneway CDF", FrameBox, {Line Width Scale( 3 )} )

    )

);

Solution

I can't find a way to address individual lines in the CDF plot by JSL. An alternative is to create the plot from scratch which would give you much more control of the appearance.

Here's an example based on the Big Class.jmp sample data:

Names Default To Here( 1 );

dt1 = Open( "$SAMPLE_DATA/Big Class.jmp" ) << Split(

  Split By( :age ),

  Split( :height ),

  Remaining Columns( Drop All )

);

Y = dt1 << get as matrix;

colors = {"red", "blue", "green", "yellow", "black", "red"};

sizes = {1, 2, 1, 2, 3, 5};

styles = {"Solid", "Solid", "Dotted", "Dashed", "DashDot", "DashDotDot"};

// Draw empirical CDF

New Window( "Empirical CDF",

  Graph Box(

  X Scale( min(Y)-1, max(Y)+1 ),

  Y Scale( -0.0, 1.1 ),

  For( j = 1, j <= N Col( Y ), j++,

  {Quant, CumProb} = CDF( Y[0, j] ); // CDF function

  Pen Color( Eval( colors[j] ) );

  Pen Size( Eval( sizes[j] ) );

  Line Style( styles[j] );

  For( i = 2, i <= N Row( Quant ), i++,

  H Line( Quant[i - 1], Quant[i], CumProb[i] );

  V Line( Quant[i - 1], CumProb[i - 1], CumProb[i] );

  )

  )

  )

);


qt

Community Trekker

Joined:

Oct 17, 2012

Thanks!

It looks like starting from scratch will make everything more flexible.

And it seems on CDF plots, when we right-click and choose 'Customizing', the changes will only apply to one plot, even we push down the 'Ctrl' button. For more general features, like 'Line Thickness', with 'Ctrl' pushed, the line thickness of all plots within that window will be changed. So 'Customizing' is a localized function?

shaira

Contributor

Joined:

May 4, 2017

Hi,

For Graph Box, do we really need to specify the colors per line?

I was wondering if instead of using this line

 

colors = {"red", "blue", "green", "yellow", "black", "red"};

 

can we tell JMP to follow the color scheme in the JMP preferences?

 

Thanks,

Shaira