cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar

Adding histogram borders to Contour Plot

Hello,

I am wondering if there is a way to add histogram borders to the Contour Plot platform or even within GraphBuilder?

It is a very useful feature within Fit Y by X and was wondering if it is possible or if it has been done before.

Given JSL is fairly flexible I thought it might be do-able but I haven't quite scoped it out.

Thank you,

JP

1 ACCEPTED SOLUTION

Accepted Solutions
ian_jmp
Level X

Re: Adding histogram borders to Contour Plot

You should be able to do what you want (but you still require JSL). Here's a toy example:

dt = Open("$SAMPLE_DATA/Car Physical Data.jmp");

// Contour plot object

cp = dt << Contour Plot(X( :Weight, :Horsepower ), Y( :Turning Circle ));

// Contour plot report layer

cpRep = Report(cp);

// See the structure of the display tree to learn how to modify it

// cpRep << ShowTreeStructure;

// Prepand a new display box to an existing element . . .

Wait(3);

cpRep[ListBox(2)] << Prepend(GraphBox());

// Appand a new display box to an existing element . . .

Wait(3);

cpRep[ListBox(2)] << Append(TextBox("Hello World ... ", << FontColor("Green")));

View solution in original post

4 REPLIES 4
louv
Staff (Retired)

Re: Adding histogram borders to Contour Plot

I used Application Builder and obtained this view combining Graph Builder and Histograms to mimic what I think you were referring to in the Fit Y by X platform.

8868_Screen Shot 2015-06-06 at 9.31.36 AM.png

Re: Adding histogram borders to Contour Plot

Thanks LouV. This is a nice solution.

I guess, I was wondering if there was a way to add panels/frames within a platform without using ApplicationBuilder to combine them using JSL.

ian_jmp
Level X

Re: Adding histogram borders to Contour Plot

You should be able to do what you want (but you still require JSL). Here's a toy example:

dt = Open("$SAMPLE_DATA/Car Physical Data.jmp");

// Contour plot object

cp = dt << Contour Plot(X( :Weight, :Horsepower ), Y( :Turning Circle ));

// Contour plot report layer

cpRep = Report(cp);

// See the structure of the display tree to learn how to modify it

// cpRep << ShowTreeStructure;

// Prepand a new display box to an existing element . . .

Wait(3);

cpRep[ListBox(2)] << Prepend(GraphBox());

// Appand a new display box to an existing element . . .

Wait(3);

cpRep[ListBox(2)] << Append(TextBox("Hello World ... ", << FontColor("Green")));

johnhoughton
Level I

Re: Adding histogram borders to Contour Plot

Use copy and paste frame contents

Open( "$ENGLISH_SAMPLE_DATA/Big Class.jmp" );

biv = bivariate( y( height ), x( weight ) , Histogram Borders( 1 ));

cont=Graph Builder(

Show Control Panel( 0 ),

Variables( X( :weight ), Y( :height ) ),

Elements(

  Contour( X, Y, Legend( 4 ), Number of Levels( 0 ) ),

  Points( X, Y, Legend( 5 ) )

)

);

rbiv = biv << report;

rcont=cont<<report;

rcont[framebox(1)]<< copy frame contents;

rbiv[framebox(3)]<<paste frame contents;;

cont<<close window;

9082_Adding histogram borders to Contour Plot.jpg

You can do this interactively as well. Create the contour plot , then right click >Edit>Copy Frame Contents.

Then create the bivariate plot with histogram borders, right-click on that and Edit>Paste Frame Contents.

Beauty of this is the axes and frame sizes all adjust automatically,

Another approach isn't so sweet. The code below is incomplete because the axis on both plots should be equal to each other. Demonstates the principal though. (The Wait commands I found were needed to avoid crashing with an exception)

Open( "$ENGLISH_SAMPLE_DATA/Big Class.jmp" );

biv = bivariate( y( height ), x( weight ) , Histogram Borders( 1 ));

cont=Graph Builder(

Size( 308, 270 ),

Show Control Panel( 0 ),

Variables( X( :weight ), Y( :height ) ),

Elements(

  Contour( X, Y, Legend( 4 ), Number of Levels( 0 ) ),

  Points( X, Y, Legend( 5 ) )

)

);

rbiv = biv << report;

rcont=cont<<report;

wait(.1);

rbiv[framebox(3)]<< sib append(rcont[framebox(1)]);

wait(.1);

rbiv[framebox(3)]<<delete;