How to save each graph from single window in graph builder into a different file format than jmp?Hi All,
I have saved the script from graph builder to produce a desired graph. I have dragged my variables and dragged my list (:Sample) onto the Wrap to produce the same graph for each category. I am trying to figure out a way of printing the same graph type for all. The issue is that running the script from graph builder will only produce one graph (which ever comes first). I thought that I would need a Loop and I have written below but does not work. Is there anyone that could give me some clues on how to do this or if you could tell me what am I doing wrong?
for(g=1, g<=N items(::Sample), g++,
For(i=1,i<=N items(Eval(::Sample[g])), i++,
gb= dt4 << Graph Builder(
Size( 894, 625 ),
Legend Position( "Bottom" ),
Show Title( 0 ),
Variables(
X( :Days ),
Y( :Model Biogas yield ),
Y( :Biogas Yield, Position( 1 ) ),
Group X( :Sample, Show Title( 0 ), N View Levels( 1 ) )
),
Elements(
Points( X, Y( 2 ), Legend( 14 ), Jitter Limit( 1.1193 ) ),
Smoother( X, Y( 1 ), Legend( 15 ) )
),
SendToReport(
Dispatch(
{},
"Days",
ScaleBox,
{Min( 0 ), Max( 21 ), Inc( 1 ), Minor Ticks( 1 ),
Label Row(
{Inside Ticks( 1 ), Set Font( "Calibri" ), Set Font Size( 14 )}
)}
),
Dispatch(
{},
"Model Biogas yield",
ScaleBox,
{Min( 0 ), Max( 700 ), Inc( 50 ), Minor Ticks( 0 ),
Label Row(
{Inside Ticks( 1 ), Set Font( "Calibri" ), Set Font Size( 14 )}
)}
),
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
14,
Level Name( 0, "Experimental", Item ID( "Biogas Yield", 1 ) ),
Properties( 0, {Marker Size( 5 )}, Item ID( "Biogas Yield", 1 ) )
), Legend Model(
15,
Level Name( 0, "Model", Item ID( "Smooth(Model Biogas yield)", 1 ) ),
Properties(
0,
{Line Color( 32 ), Line Width( 3 )},
Item ID( "Smooth(Model Biogas yield)", 1 )
)
)}
),
Dispatch(
{},
"X title",
TextEditBox,
{Set Font( "Calibri" ), Set Font Size( 14 )}
),
Dispatch(
{},
"Y title",
TextEditBox,
{Set Font( "Calibri" ), Set Font Size( 14 ),
Set Text( "Biogas yield (m3/t VS)" )}
)
)
);
gb<< Save picture ("C:\data\Graph Builder_" || ::Sample[g]||".jpg", JPEG);
););
Re: How to save each graph from single window in graph builder into a different file format than jmpYes, I want to save the individual graph into an individual image file that can be under any MS platform as described below.Re: How to save each graph from single window in graph builder into a different file format than jmpHI Phil and Jim,
Using the Big class example. If I would like to plot Weight vs height by Sex I would have the following Graph builder script:
dt= Open ("C:\Program Files\SAS\JMP\14\Samples\Data\Big Class.JMP");
dt<< Graph Builder(
Variables( X( :weight ), Y( :height ), Wrap( :sex, N View Levels( 1 ) ) ),
Elements( Points( X, Y, Legend( 7 ) ), Smoother( X, Y, Legend( 9 ) ) )
);
What I want to do is to then save the resulting graph for each :Sex. How do I do that?
Re: How to save each graph from single window in graph builder into a different file format than jmp
How is this as an example of the kind of thing you want to do?
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
Graph Builder(
Size( 564, 350 ),
Show Control Panel( 0 ),
Variables( X( :weight ), Y( :height ), Group X( :sex ) ),
Elements( Line Of Fit( X, Y, Legend( 8 ) ), Points( X, Y, Legend( 9 ) ) )
);
And you want to save height vs weight for each level of the Group X variable as an individual image file?
Re: How to save each graph from single window in graph builder into a different file format than jmpCan you provide a simpler but more complete example of what you are trying to do? Maybe using the Big Class data. It will be easier for community members to help if you explain the situation and question more clearly and in a more general way so that any solution will be readily useful for others.
Re: How to save each graph from single window in graph builder into a different file format than jmpThe "Sample" is from the code you provided to this discussion. So I can not help you with your question. In your code, you did not show where "Sample" was created. It just appears in the code.
Re: How to save each graph from single window in graph builder into a different file format than jmpI have tried :Sample and ::Sample as below and I have run the JSL debugger:
for(g=1, g<=N items(:sample), print(:sample),
For(i=1,i<=N items(Eval(:Sample[g])), i++,
gb= dt4 << Graph Builder(
Size( 894, 625 ),
Legend Position( "Bottom" ),
Show Title( 0 ),
Variables(
X( :Days ),
Y( :Model Biogas yield ),
Y( :Biogas Yield, Position( 1 ) ),
Group X( :Sample, Show Title( 0 ), N View Levels( 1 ) )
When I use :Sample I get the error N items() must be a list.
When I use ::Sample I get the error Name unresolved: Sample in access of evaluation of 'sample', ::sample/*##*/
I am not sure where to look for the value?
Re: How to save each graph from single window in graph builder into a different file format than jmpThe reference to
::sample
is a reference to a JSL memory variable, not to a column
If you want to refer to a column you would specify
:sample
// or
dt4:sample
// or if referring to a specific row value, like row 7's value
dt4:sample[7]
Please run your script and place the following line in front of your first For() loop
print(::sample);
and then look into the log, and see what the value it has.
Re: How to save each graph from single window in graph builder into a different file format than jmpI have attached a screen shoot of the dt.

Re: How to save each graph from single window in graph builder into a different file format than jmpI may be calling it the wrong thing. Still getting familiar with these terms. It is a nominal character. For each group of variables there is a Nominal character. Basically one column named Sample matching a group of variables. It is basically a fourth variable. So I guess I would need to also use a conditional sentence in this case?Re: How to save each graph from single window in graph builder into a different file format than jmpOK.....I will try to be more specific......I don't see how you are using a JSL list, and making it work....I would still like to see exactly what your variable ::sample value is. Here is why:
If your ::sample is a character list
::sample = {"one", "Two", "three"};
For( g = 1, g <= N Items( ::Sample ), g++,
For( i = 1, i <= N Items( Eval( ::Sample[g] ) ), i++,
Print( "C:\data\Graph Builder_" || ::Sample[g] || ".jpg" )
)
);
the code fails with the following error:
::sample = {"one", "Two", "three"};
For( g = 1, g <= N Items( ::Sample ), g++,
For( i = 1, i <= N Items( Eval( ::Sample[g] ) ), i++,
Print( "C:\data\Graph Builder_" || ::Sample[g] || ".jpg" )
)
);
/*:
N Items() argument must be a list
If the list is a numeric list of values
::sample = {1, 2, 3};
For( g = 1, g <= N Items( ::Sample ), g++,
Print( "C:\data\Graph Builder_" || ::Sample[g] || ".jpg" )
);
The code will fail when you attempt to concatenate the string in your save picture
argument should be character in access or evaluation of 'Concat' , Bad Argument( ::Sample[g] ), "C:\data\Graph Builder_" || /*###*/::Sample[g] || /*###*/".jpg" /*###*/
In the following script, error marked by /*###*/
::sample = {1, 2, 3};
For( g = 1, g <= N Items( ::Sample ), g++,
Print(
"C:\data\Graph Builder_" || /*###*/::Sample[g] || /*###*/".jpg" /*###*/
)
);
So that is why I would like to see exactly what your ::sample list contains......
That would also help in interpreting what the purpose of your 2 loops are.
Re: How to save each graph from single window in graph builder into a different file format than jmpYes It is a JSL List
Re: How to save each graph from single window in graph builder into a different file format than jmpOK, but I will once again ask for you to show what the variable ::Sample is. Is it a JSL list, or a character variable???? What is it's value?Re: How to save each graph from single window in graph builder into a different file format than jmpI would like to keep the same graph. I just want to save the graph 12 times or save it by :Sample regardless and save it in a file that has the correspondent name in :Sample . Does that make sense?
Re: How to save each graph from single window in graph builder into a different file format than jmpThe Graph Builder code that you have specified, only produces one graph. And when you loop through g and I, you are not changing anything in the Graph Builder specification, that would indicate that you want anything different in the graph that is produced. What are you expecting to change from graph to graph?Re: How to save each graph from single window in graph builder into a different file format than jmpIt is not a value but rather names of 12 categories. Each will have graph.Re: How to save each graph from single window in graph builder into a different file format than jmpCan you supply what the value of ::Sample is? You seem to be writing on top of the same file multiple times......