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
ankitgssingh
Level III

How do I merge two different types of graphs horizontally into a journal?

 

////////////////////////////////////////Makes 'N' overlay plots. One each for each "Parameter Name"////////////////////////////////////////////////////////

overlayplot = table1 << Overlay Plot(
    X( :column1 ),
    Y( :Name( "Mean(Parameter Value)" ) ),
    Grouping( :GROUP ),
    SendToByGroup(
        {:Parameter Name == Eval( :Parameter Name )},
        Overlay Groups,
        Connect Thru Missing( 1 ),
        Connect Points( 1 ),
        :Name( "Mean(Parameter Value)" )(Overlay Marker( 8 ), Line Width( "Thick" ))
    ),
    By( :Parameter Name ),

);

 

////////////////////////////////////////Makes 'N' Oneway plots. One each for each "Parameter Name"////////////////////////////////////////////////////////

ttest_plot = table1 << Oneway(
    Y( :Name( "Mean(Parameter Value)" ) ),
    X( :GROUP ),
    Plot Quantile by Actual( 1 ),
    Line of Fit( 0 ),
    Box Plots( 1 ),
    Mean Diamonds( 0 ),
    X Axis Proportional( 0 ),
    Points Jittered( 1 ),
    SendToReport(
        Dispatch(
            {},
            "Oneway Plot",
            FrameBox,
            {DispatchSeg(
                Box Plot Seg( 1 ),
                {Box Type( "Outlier" ), Confidence Diamond( 0 ),
                Shortest Half Bracket( 0 ), Line Color( "Red" )}
            ), DispatchSeg(
                Box Plot Seg( 2 ),
                {Box Type( "Outlier" ), Confidence Diamond( 0 ),
                Shortest Half Bracket( 0 ), Line Color( "Red" )}
            )}
        )
    ),
    By( :Parameter Name )
);

 

 

The above code makes equal number of overlay and oneway plots from my data. There are 84 unique "Parameter Names" so I get 84 overlay plots and 84 Oneway plots. 

 

I am trying to combine them into a journal so that for each parameter I get the oneway plot right next to the overlay plot...and then subsequent plots vertically. 

 

How can I do that? 

 

This is the output I need

ankitgssingh_0-1626973261639.png

 

 

This is the output I am getting

ankitgssingh_1-1626973397166.png

 

@txnelson #JMP

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How do I merge two different types of graphs horizontally into a journal?

Here is a rework of your script that I believe will give you a good start on your script

txnelson_0-1626984255437.png

Names Default To Here( 1 );
dt = Open( "$sample_data/big class.jmp" );
overlayplot = dt << Overlay Plot(invisible,
	X( :height ),
	Y( :Name( "weight" ) ),
	Grouping( :sex ),
	SendToByGroup(
		{:age == Eval( :age )},
		Overlay Groups,
		Connect Thru Missing( 1 ),
		Connect Points( 1 ),
		:Name( "weight" )(Overlay Marker( 8 ), Line Width( "Thick" ))
	),
	By( :age )
);

////////////////////////////////////////Makes 'N' Oneway plots. One each for each "Parameter Name"////////////////////////////////////////////////////////

ttest_plot = dt << Oneway(invisible,
	Y( :weight ),
	X( :sex ),
	Normal Quantile Label( 0 ),
	Box Plots( 1 ),
	X Axis Proportional( 0 ),
	Points Jittered( 1 ),
	by( :age ),
	SendToReport(
		Dispatch(
			{},
			"Oneway Plot",
			FrameBox,
			{DispatchSeg(
				Box Plot Seg( 1 ),
				{Confidence Diamond( 0 ), Line Color( "Red" )}
			), DispatchSeg(
				Box Plot Seg( 2 ),
				{Confidence Diamond( 0 ), Line Color( "Red" )}
			)}
		)
	)
);

// Create the output window
nw = new window("The Output", lub = lineup Box( NCol(2)));

// Find the numeber of by groupws
summarize(dt, bygroups = by(:age));
numByGroups = nitems(bygroups);

For(i=1,i<=numByGroups,i++,
	lub<<append(report(ttest_plot[i])[outlinebox(1)]);
	lub<<append(report(overlayplot[i])[outlinebox(1)]);
);

Note: I manually reduced the size of the overlay plots, you will need to add the JSL to set the frame size properly.

 

Jim

View solution in original post

3 REPLIES 3
jthi
Super User

Re: How do I merge two different types of graphs horizontally into a journal?

You can try using H List Box to set them side by side, but will most likely run into some issues with the sizing of different reports and have to handle that somehow. Below is an example with two different options which might give an idea how to do this (I haven't really used journals, so that part of the example might be a bit bad):

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");

/*with by*/
graph1 = Expr(dt << Oneway(Y(:height), X(:age), By(:sex)));
graph2 = Expr(dt << Graph Builder(
	Show Control Panel(0),
	Show Legend(0),
	Variables(X(Transform Column("Row", Formula(Row()))), Y(:height), Group Y(:age)),
	Elements(Points(X, Y, Legend(1))),
	By(:sex)
));
nw = new window("",
	h list box(
		vlistbox(graph1),
		vlistbox(graph2)
	)
);
nw << journal window;
nw << close window;
stop();

/* without by*/
graph1 = Expr(dtTemp << Oneway(Y(:height), X(:age)));
graph2 = Expr(dtTemp << Graph Builder(
	Show Control Panel(0),
	Show Legend(0),
	Variables(X(Transform Column("Row", Formula(Row()))), Y(:height), Group Y(:age)),
	Elements(Points(X, Y, Legend(1)))
));
nw = new window("",
	vlb = v list box();
);

nw << Journal Window;
nw << close window;
byVals = Associative Array(dt:sex) << get keys;

For(i = 1, i <= N Items(byVals), i++,
	dt << Select Where(:sex == byVals[i]);
	dtTemp = dt << Subset(Selected Rows, all columns);
	hlb = V List Box(
		TextBox(byVals[i]),
		Lineup box(N Col(2),
			graph1,
			graph2
		)
	);
	hlb << Journal;
	Close(dtTemp, no save);
);

 

-Jarmo
txnelson
Super User

Re: How do I merge two different types of graphs horizontally into a journal?

Here is a rework of your script that I believe will give you a good start on your script

txnelson_0-1626984255437.png

Names Default To Here( 1 );
dt = Open( "$sample_data/big class.jmp" );
overlayplot = dt << Overlay Plot(invisible,
	X( :height ),
	Y( :Name( "weight" ) ),
	Grouping( :sex ),
	SendToByGroup(
		{:age == Eval( :age )},
		Overlay Groups,
		Connect Thru Missing( 1 ),
		Connect Points( 1 ),
		:Name( "weight" )(Overlay Marker( 8 ), Line Width( "Thick" ))
	),
	By( :age )
);

////////////////////////////////////////Makes 'N' Oneway plots. One each for each "Parameter Name"////////////////////////////////////////////////////////

ttest_plot = dt << Oneway(invisible,
	Y( :weight ),
	X( :sex ),
	Normal Quantile Label( 0 ),
	Box Plots( 1 ),
	X Axis Proportional( 0 ),
	Points Jittered( 1 ),
	by( :age ),
	SendToReport(
		Dispatch(
			{},
			"Oneway Plot",
			FrameBox,
			{DispatchSeg(
				Box Plot Seg( 1 ),
				{Confidence Diamond( 0 ), Line Color( "Red" )}
			), DispatchSeg(
				Box Plot Seg( 2 ),
				{Confidence Diamond( 0 ), Line Color( "Red" )}
			)}
		)
	)
);

// Create the output window
nw = new window("The Output", lub = lineup Box( NCol(2)));

// Find the numeber of by groupws
summarize(dt, bygroups = by(:age));
numByGroups = nitems(bygroups);

For(i=1,i<=numByGroups,i++,
	lub<<append(report(ttest_plot[i])[outlinebox(1)]);
	lub<<append(report(overlayplot[i])[outlinebox(1)]);
);

Note: I manually reduced the size of the overlay plots, you will need to add the JSL to set the frame size properly.

 

Jim
ankitgssingh
Level III

Re: How do I merge two different types of graphs horizontally into a journal?

Thank you. Worked perfectly. Just needed to set the frame size.