turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Trouble with Report << Copy Graph

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Mar 24, 2015 6:12 PM
(1394 views)

Hi,

I am trying to copy a residual graph to put separately into a journal, but I am unable to copy the graph I want. Get Picture seems to work, but I prefer an interactive graph over a static picture. Any suggestions? I am using JMP11. Thanks!

// Example

dt = Open( Convert File Path( "$Sample_Data" ) || "Big Class.jmp" );

biv = dt << Bivariate(

Y( :height ),

X( :weight ),

Fit Line( {Plot Residuals( 1 ), Line Color( {213, 72, 87} )} )

);

rbiv = biv << Report;

title = rbiv << Get Title;

rbiv[OutlineBox("Residual by X Plot")] << Select; // I can select and deselect the graph I want.

rbiv[OutlineBox("Residual by X Plot")] << Deselect;

residual = rbiv[OutlineBox("Residual by X Plot")] << Copy Graph; // I can not get this to work.

// residual = rbiv[OutlineBox("Residual by X Plot")] << Get Picture; // This works, but I prefer a graph over a picture.

out = Outline Box(title, residual);

New Window(title, out);

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Solution

That's interesting. Is there a reason you can't just directly journal the graph? Here's an example, gluing the previous question and this one together. It doesn't do rows and columns or re-order the graphs in any way, but maybe you can plug it into your system and get what you want.

// Previous example - get all your subsets and reports

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

ages = Associative Array( :age );

currentkey = ages << First;

For( i = 1, i <= N Items( ages ), i++,

nextkey = ages << Next( currentkey );

ages[currentkey] = {}; // make each age hold a list

dt << Select Where( :age == currentkey );

// add the subset table to the list for this age:

Insert Into(ages[currentkey], dt << Subset( Output Table Name( "Subset " || Char( currentkey ) ) ) );

dt << Clear Select;

// add the bivariate report to the list for this age:

Insert Into(ages[currentkey], ages[currentkey][1] << Bivariate( Y( :height ), X( :weight ), Fit Line( {Plot Residuals( 1 ), Line Color( {213, 72, 87} )} ) ) );

currentkey = nextkey;

);

Close( dt, No Save );

// Iterate through the associative array and journal the specific graph you want

currentkey = ages << First;

For( i = 1, i <= N Items( ages ), i++,

nextkey = ages << Next( currentkey );

rbiv = ages[currentkey][2] << Report;

title = rbiv << Get Title;

rbiv[OutlineBox("Residual by X Plot")] << Journal;

currentkey = nextkey;

);

// You could get the keys into a list and put them in some order

// and then iterate through the array using the list of keys.

// That might look something like this:

myKeys = ages << get keys;

myKeys = Sort Descending(myKeys);

For( i = 1, i <= N Items( myKeys ), i++,

rbiv = ages[myKeys*][2] << Report;*

title = rbiv << Get Title;

rbiv[OutlineBox("Residual by X Plot")] << Journal;

);

4 REPLIES

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Mar 25, 2015 9:52 AM
(1025 views)

Copy Graph copies the graph and its axes onto the clipboard, where you can then use paste into another document - not interactive. Get Picture takes a picture of the graph and turns it into an image. Journals are static - they do not contain live analyses.

There is no way to get an interactive picture of a graph. The only thing I can think of is to export as interactive html, but then you have a web page, not an image. The message for that is <<Save Interactive HTML(pathname).

What is your goal?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Mar 25, 2015 10:10 AM
(1025 views)

Hi Melanie,

I am scripting an analysis of many residual plots, each with different test parameters (time, voltage, capacitance, etc.) and I think it would be useful to organize the residual plots in manner that is representative of these variables (IE: have graphs organized in columns by capacitance, and in rows by voltage). To accomplish this, I am collecting residual plots and storing them in an associative array (per your earlier suggestion), and then reorganizing them in the final journal.

If possible, I would like the user to be able to zoom, adjust axes, and use the crosshair tool, as in a normal journal. If this is not possible, a picture will work fine; I just want to make sure the user's lack of interaction is not due to my marginal knowledge of JSL.

Do you have any suggestions?

Rob

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

That's interesting. Is there a reason you can't just directly journal the graph? Here's an example, gluing the previous question and this one together. It doesn't do rows and columns or re-order the graphs in any way, but maybe you can plug it into your system and get what you want.

// Previous example - get all your subsets and reports

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

ages = Associative Array( :age );

currentkey = ages << First;

For( i = 1, i <= N Items( ages ), i++,

nextkey = ages << Next( currentkey );

ages[currentkey] = {}; // make each age hold a list

dt << Select Where( :age == currentkey );

// add the subset table to the list for this age:

Insert Into(ages[currentkey], dt << Subset( Output Table Name( "Subset " || Char( currentkey ) ) ) );

dt << Clear Select;

// add the bivariate report to the list for this age:

Insert Into(ages[currentkey], ages[currentkey][1] << Bivariate( Y( :height ), X( :weight ), Fit Line( {Plot Residuals( 1 ), Line Color( {213, 72, 87} )} ) ) );

currentkey = nextkey;

);

Close( dt, No Save );

// Iterate through the associative array and journal the specific graph you want

currentkey = ages << First;

For( i = 1, i <= N Items( ages ), i++,

nextkey = ages << Next( currentkey );

rbiv = ages[currentkey][2] << Report;

title = rbiv << Get Title;

rbiv[OutlineBox("Residual by X Plot")] << Journal;

currentkey = nextkey;

);

// You could get the keys into a list and put them in some order

// and then iterate through the array using the list of keys.

// That might look something like this:

myKeys = ages << get keys;

myKeys = Sort Descending(myKeys);

For( i = 1, i <= N Items( myKeys ), i++,

rbiv = ages[myKeys*][2] << Report;*

title = rbiv << Get Title;

rbiv[OutlineBox("Residual by X Plot")] << Journal;

);

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Mar 25, 2015 6:48 PM
(1025 views)

Thanks Melanie. I think your solution will work. I also tried saving the residuals to the original data table and then graphing the results from there.

// Open table.

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

// Get residuals.

biv = Platform( dt, Bivariate( Y( :height ), X( :weight ), By( :age, :sex ), Fit Line( {Save Residuals( 1 )} ) ) );

// Get residual graphs.

ages = Associative Array( :age );

currentkey = ages << First;

For( i = 1, i <= N Items( ages ), i++,

nextkey = ages << Next( currentkey );

ages[currentkey] = {};

dt << Select Where( :age == currentkey );

Insert Into( ages[currentkey], dt << Subset( Output Table Name( "Subset " || Char( currentkey ) ), Invisible ) );

dt << Clear Select;

Insert Into(

ages[currentkey],

Platform( ages[currentkey][1], Bivariate( Y( :Residuals height By age By sex ), X( :weight ), By( :age, :sex ) ) )

);

currentkey = nextkey;

);

// Organize and plot data.

out = Outline Box( "Residuals height By age By sex", hb = H List Box() );

currentkey = ages << First;

For( i = 1, i <= N Items( ages ), i++,

nextkey = ages << Next( currentkey );

Eval( Substitute( Expr( hb << Append( ages[currentkey][2] ) ), Expr( currentkey ), currentkey ) );

currentkey = nextkey;

);

New Window( "Residuals height By age By sex", out ) << Journal;

// Close data tables.

currentkey = ages << First;

For( i = 1, i <= N Items( ages ), i++,

nextkey = ages << Next( currentkey );

Close( ages[currentkey][1], No Save );

currentkey = nextkey;

);

Close( dt, No Save );