Subscribe Bookmark RSS Feed

How to do boxplot if both x and y are quantitative variable?

kelvin_lai

Community Trekker

Joined:

Jul 14, 2014

Hi

I am new in JMP, and it may be a simple question.  I would like to do a boxplot (instead of a scatter plot)  with id(y) vs Length(x) (both are quantitative variable).  Somehow I can only choose boxplot when X(length) is categorical variable, I can't find example in help when x is quantitative variable.

Thanks in advance for help.

Kelvin

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

It's possible to do this in Graph Builder, in JMP 10 and JMP 11.  What version of JMP are you using?

I created a simple table with an X and Y column, where both were quantitative (=continuous) variables.  I was able to click on the boxplot icon to create a boxplot no problem.

Try copying and pasting the following code into a script window, and then hit CTRL-R to run it.

New Table( "Demo Box Plot",

    Add Rows( 13 ),

    New Script(

        "Graph Builder",

        Graph Builder(

            Show Control Panel( 0 ),

            Variables( X( :x ), Y( :Column 2 ) ),

            Elements(

                Box Plot(

                    X, Y, Legend( 3 ), Jitter( 1 ),

                   Outliers( 1 ), Box Style( "Outlier" )

                )

            )

        )

    ),

    New Column( "x", Numeric, Continuous,

        Format( "Best", 12 ),

        Set Values( [1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4] )

    ),

    New Column( "Column 2", Numeric,

        Continuous,   Format( "Best", 12 ),

        Set Values( [20.1, 20.3, 18, 15, 17, 34, 65, 45, 34, 54, 34, 12, 24] )

    )

);

3 REPLIES
Solution

It's possible to do this in Graph Builder, in JMP 10 and JMP 11.  What version of JMP are you using?

I created a simple table with an X and Y column, where both were quantitative (=continuous) variables.  I was able to click on the boxplot icon to create a boxplot no problem.

Try copying and pasting the following code into a script window, and then hit CTRL-R to run it.

New Table( "Demo Box Plot",

    Add Rows( 13 ),

    New Script(

        "Graph Builder",

        Graph Builder(

            Show Control Panel( 0 ),

            Variables( X( :x ), Y( :Column 2 ) ),

            Elements(

                Box Plot(

                    X, Y, Legend( 3 ), Jitter( 1 ),

                   Outliers( 1 ), Box Style( "Outlier" )

                )

            )

        )

    ),

    New Column( "x", Numeric, Continuous,

        Format( "Best", 12 ),

        Set Values( [1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4] )

    ),

    New Column( "Column 2", Numeric,

        Continuous,   Format( "Best", 12 ),

        Set Values( [20.1, 20.3, 18, 15, 17, 34, 65, 45, 34, 54, 34, 12, 24] )

    )

);

kelvin_lai

Community Trekker

Joined:

Jul 14, 2014

Yes, It works.  Thank you. 

Steven_Moore

Super User

Joined:

Jun 4, 2014

Another way to do this:  Suppose your X values are no integers.  You can set up a nominal/categorical X variable by defining ranges of the X variable.  For example, let x = 0 - 5 be A, x = 5.1 - 10 = B, x = 10.1 -15 =15, etc.  Then you can do boxplots very nicely. 

Steve