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
nlc4
Level I

Saving a graph as an image file without the "graph builder" header in the image. Can someone please advise?

Saving a graph as an image file without the "graph builder" header in the image.  Can someone please advise?

2 ACCEPTED SOLUTIONS

Accepted Solutions
nascif_jmp
Level VI

Re: Saving a graph as an image file without the "graph builder" header in the image. Can

I haven't checked the video but the articles don't address the customer need, "Saving a graph as an image file without the "graph builder" header in the image" using a script and not the user interface. The following function does the trick:

 

save_graph_only = function({gb, pic_file}, {Default Locals},
    rpt = gb << report;
    (rpt << Child) << save picture(pic_file);	
);

Here is a complete example:

Names Default to Here(1);

save_graph_only = function({gb, pic_file}, {Default Locals},
    rpt = gb << report;
    (rpt << Child) << save picture(pic_file);	
);

pic_file = "$TEMP/graph_no_outline.png";
dt = Open("$SAMPLE_DATA/Iris.jmp");
gb = dt << Graph Builder(
    Show Control Panel( 0 ),
    Variables( X( :Sepal length ), Y( :Sepal width ), Overlay( :Species ) ),
    Elements(
        Contour( X, Y, Legend( 3 ), Number of Levels( 3 ) ),
        Points( X, Y, Legend( 4 ) )
    ),
    SendToReport(
        Dispatch(
            {},
            "Sepal length",
            ScaleBox,
            {Min( 4.02451368343195 ), Max( 8.24903846153846 ), Inc( 1 ),
            Minor Ticks( 0 )}
        ),
        Dispatch(
            {},
            "Sepal width",
            ScaleBox,
            {Min( 1.75 ), Max( 5.00400457665904 ), Inc( 1 ), Minor Ticks( 0 )}
        ),
        Dispatch(
            {},
            "400",
            LegendBox,
            {Legend Position( {3, [0, 1, 2], 4, [-1, -1, -1]} ),
            Position( {0, 1, 2, -1, -1, -1} )}
        )
    )
);
save_graph_only(gb, pic_file);
dt << Close Window();
open(pic_file);

View solution in original post

pmroz
Super User

Re: Saving a graph as an image file without the "graph builder" header in the image. Can

Here's a simple way to remove Graph Builder from a graph.  You lose the outline box with the little red triangle.  If you still want the outline box you can replace Graph Builder with a label of your choosing.

dt = open("$sample_data\Big Class.jmp");

Graph Builder(
	Size( 526, 451 ),
	Show Control Panel( 0 ),
	Variables( X( :weight ), Y( :height ), Overlay( :sex ) ),
	Elements( Line Of Fit( X, Y, Legend( 16 ) ), Points( X, Y, Legend( 17 ) ) ),
	SendToReport( Dispatch( {}, "Graph Builder",
			OutlineBox, {Set Title( "" )}
		)
	)
);

View solution in original post

7 REPLIES 7
KarenC
Super User (Alumni)

Re: Saving a graph as an image file without the "graph builder" header in the image. Can someone please advise?

If you use the "selection" tool (under the tools menu or the fat plus symbol on your tool bar) you can select just the graph.  You can also click on the graph title to edit (or delete).

Re: Saving a graph as an image file without the "graph builder" header in the image. Can someone please advise?

Hello nlc4. We have a one-page guide describing how to save out graphics from JMP using the technique that karen@boulderstats has outlined. It is available on our learning library: jmp.com/learn or directly here:

You can also see how to do it in this quick video I captured here:

Connect with me on LinkedIn: https://bit.ly/3MWgiXt
JohnTM
Level III

Re: Saving a graph as an image file without the "graph builder" header in the image. Can

I know this is a really old post, but the link no longer works.  Is there an updated link to follow, and does this include information on removing the title/header from within a script, and not just through the user interface?

stan_koprowski
Community Manager Community Manager

Re: Saving a graph as an image file without the "graph builder" header in the image. Can

Hi @JohnTM,

I have updated the links to the content.

cheers,

Stan

nascif_jmp
Level VI

Re: Saving a graph as an image file without the "graph builder" header in the image. Can

I haven't checked the video but the articles don't address the customer need, "Saving a graph as an image file without the "graph builder" header in the image" using a script and not the user interface. The following function does the trick:

 

save_graph_only = function({gb, pic_file}, {Default Locals},
    rpt = gb << report;
    (rpt << Child) << save picture(pic_file);	
);

Here is a complete example:

Names Default to Here(1);

save_graph_only = function({gb, pic_file}, {Default Locals},
    rpt = gb << report;
    (rpt << Child) << save picture(pic_file);	
);

pic_file = "$TEMP/graph_no_outline.png";
dt = Open("$SAMPLE_DATA/Iris.jmp");
gb = dt << Graph Builder(
    Show Control Panel( 0 ),
    Variables( X( :Sepal length ), Y( :Sepal width ), Overlay( :Species ) ),
    Elements(
        Contour( X, Y, Legend( 3 ), Number of Levels( 3 ) ),
        Points( X, Y, Legend( 4 ) )
    ),
    SendToReport(
        Dispatch(
            {},
            "Sepal length",
            ScaleBox,
            {Min( 4.02451368343195 ), Max( 8.24903846153846 ), Inc( 1 ),
            Minor Ticks( 0 )}
        ),
        Dispatch(
            {},
            "Sepal width",
            ScaleBox,
            {Min( 1.75 ), Max( 5.00400457665904 ), Inc( 1 ), Minor Ticks( 0 )}
        ),
        Dispatch(
            {},
            "400",
            LegendBox,
            {Legend Position( {3, [0, 1, 2], 4, [-1, -1, -1]} ),
            Position( {0, 1, 2, -1, -1, -1} )}
        )
    )
);
save_graph_only(gb, pic_file);
dt << Close Window();
open(pic_file);
pmroz
Super User

Re: Saving a graph as an image file without the "graph builder" header in the image. Can

Here's a simple way to remove Graph Builder from a graph.  You lose the outline box with the little red triangle.  If you still want the outline box you can replace Graph Builder with a label of your choosing.

dt = open("$sample_data\Big Class.jmp");

Graph Builder(
	Size( 526, 451 ),
	Show Control Panel( 0 ),
	Variables( X( :weight ), Y( :height ), Overlay( :sex ) ),
	Elements( Line Of Fit( X, Y, Legend( 16 ) ), Points( X, Y, Legend( 17 ) ) ),
	SendToReport( Dispatch( {}, "Graph Builder",
			OutlineBox, {Set Title( "" )}
		)
	)
);
JohnTM
Level III

Re: Saving a graph as an image file without the "graph builder" header in the image. Can

Thanks to you both pmroz and nascif_jmp!  

It is honestly hard to pick one for which solution I like best. The addition of 

Dispatch( {}, "Graph Builder", OutlineBox, {Set Title( "" )}),

is a simple one line of added code solution, and if you need the options just add back in a title. Yet nascif_jmp's function example provides the same clean image, but retains the ability to access the options at a later time without needing to remember to change the script if the user is saving the graph scripts back into the data table.