cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
jvillaumie
Level III

Using JSL to copy the frame contents of one graph to a different graph?

Hello,

I am trying to overlay the contents of two separate variability charts, using JSL. My JSL script already generates the two variability charts.

I can do the overlay manually using Copy frame contents one the 1st chart and Paste frame contents on the second chart, but I want to automate the process so the script does the overlay itself, after making the plots.

Are there JSL commands that can do this?

1 ACCEPTED SOLUTION

Accepted Solutions
ian_jmp
Level X

Re: Using JSL to copy the frame contents of one graph to a different graph?

NamesDefaultToHere(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

v1 = dt << Variability Chart(Y( :height ), X( :age ), Std Dev Chart( 0 ), Points Jittered( 1 ));

v2 = dt << Variability Chart(Y( :weight ), X( :age ), Std Dev Chart( 0 ), Points Jittered( 1 ));

v1Rep = v1 << Report;

v2Rep = v2 << Report;

v1Rep[FrameBox(1)] << CopyFrameContents;

v2Rep[FrameBox(1)] << PasteFrameContents;

View solution in original post

8 REPLIES 8
ian_jmp
Level X

Re: Using JSL to copy the frame contents of one graph to a different graph?

NamesDefaultToHere(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

v1 = dt << Variability Chart(Y( :height ), X( :age ), Std Dev Chart( 0 ), Points Jittered( 1 ));

v2 = dt << Variability Chart(Y( :weight ), X( :age ), Std Dev Chart( 0 ), Points Jittered( 1 ));

v1Rep = v1 << Report;

v2Rep = v2 << Report;

v1Rep[FrameBox(1)] << CopyFrameContents;

v2Rep[FrameBox(1)] << PasteFrameContents;

jvillaumie
Level III

Re: Using JSL to copy the frame contents of one graph to a different graph?

Thanks for the quick answer Ian.

itzikd
Level II

Re: Using JSL to copy the frame contents of one graph to a different graph?

Thanks for the help,

I have 1 more question, I'm trying to get what I marked in red, how can I get the X Y Value?

it seems like I'm able to get only the title 

if I do instead of "get text" --> "get xml" it shows ALOT of info including the X Y values but that looks like its a harder way to do it...

 

 

Re: Using JSL to copy the frame contents of one graph to a different graph?

Names Default to Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

biv = dt << Bivariate( X( :height ), Y( :weight ) );

bivr = biv << Report;

title = bivr[OutlineBox(1)] << Get Title;

x = Column( Regex( title, "Bivariate Fit of (.+) By (.+)", "\1" ) );
y = Column( Regex( title, "Bivariate Fit of (.+) By (.+)", "\2" ) );

Re: Using JSL to copy the frame contents of one graph to a different graph?

Use the XML code to find the tag for the information that you want. Then use the << XPath( expr ) message to work with it. You can get a reference to the node, the value associated with the node, and more. The expressions in the XPath Query Language make this task easy.

 

xpath.PNG

pmroz
Super User

Re: Using JSL to copy the frame contents of one graph to a different graph?

Hi folks,

I want to do something similar but with a twist.  I'm doing a Fit Generalized Model, and I want to show confidence curves on the regression graph.  I can right click on the profiler and select Edit > Copy frame contents.  Then I right click on the regression graph and select Edit > Paste frame contents.  This is my result:

11810_Combined.png

My question is: how do I do this in JSL?  This is my (feeble) attempt but it doesn't work:

fm = Fit Model(

     Y( :Name( "Sum(One Effect)" ), :Total ),

     Effects( :Period ),

     Personality( Generalized Linear Model ),

     GLM Distribution( Binomial ),

     Link Function( Logit ),

     Overdispersion Tests and Intervals( 0 ),

     Name( "Firth Bias-adjusted Estimates" )(0),

     Run( 1, Profiler( 1, Confidence Intervals( 1 ),

                Term Value( Period( 5.5, Lock( 0 ), Show( 1 ) ) )

           )

     )

);

// Run this to find relevant portions of the tree

//fm << show tree structure;

fmrep = fm << report;

fmrep[framebox(3)] << copy frame contents;

fmrep[framebox(1)] << paste frame contents;

SDF1
Super User

Re: Using JSL to copy the frame contents of one graph to a different graph?

Hi @pmroz ,

 

  I can't duplicate the error you are experiencing without using the same data table. But, your code should be working in general.

 

  I tested something similar out on the Titanic Passengers.jmp file. The below JSL code works and it copy/pastes the contents from the one report (profiler) to the logistic fit plot of the other report. I followed your same basic JSL and it worked.

Names Default to Here( 1 );

fm = Fit Model(
	Y( :Survived ),
	Effects( :Age ),
	Personality( "Generalized Linear Model" ),
	GLM Distribution( "Binomial" ),
	Link Function( "Logit" ),
	Overdispersion Tests and Intervals( 0 ),
	Name( "Firth Bias-Adjusted Estimates" )(0),
	Run( 1, Profiler( 1, Confidence Intervals( 1 ), Term Value( Age( 29.881, Lock( 0 ), Show( 1 ) ) ) ) )
);

fmrep = fm << report;

lf = Logistic( Y( :Survived ), X( :Age ) );

lfrep = lf << report;

fmrep[framebox( 2 )] << Copy Frame Contents;

lfrep[framebox( 1 )] << paste frame Contents;

  I could also get it to work on the Desirability vs Age within the GLM report window.

Names Default to Here( 1 );

fm = Fit Model(
	Y( :Survived ),
	Effects( :Age ),
	Personality( "Generalized Linear Model" ),
	GLM Distribution( "Binomial" ),
	Link Function( "Logit" ),
	Overdispersion Tests and Intervals( 0 ),
	Name( "Firth Bias-Adjusted Estimates" )(0),
	Run(
		1,
		Profiler(
			1,
			Confidence Intervals( 1 ),
			Desirability Functions( 1 ),
			Term Value( Age( 29.881, Lock( 0 ), Show( 1 ) ) )
		)
	)
);

fmrep = fm << report;

fmrep[framebox( 2 )] << Copy Frame Contents;

fmrep[framebox( 3 )] << paste frame Contents;

  Can you share the data table you're working with?

 

Hope this helps!,

DS

pmroz
Super User

Re: Using JSL to copy the frame contents of one graph to a different graph?

Hi DS,

 

Thanks for your response, but I changed tactics a while ago.  I do the regression analysis, save the results to a table, and use Graph Builder to display the results.  No more copy/pasting.