Minitab macro vs. Layout tool

M

MiniNik

Hello everybody,
I'm new in here and glad, that i've found this forum.
you will hardly believe it, but i'm here because i have a problem and i hope, you can give me some good advices.:)
My plan is to write a macro for minitab. This worked out quite fine, but now i have quite a lot of graphs in my analysis. I want to reduce the number of open windows and therefore to fit four different graphs (eg Histogram, NormTest) in one window. I know there is the layout tool for the manual way, but what can i do to get this or an similair function in my macro to implement the four graphs into one window automatically?
I hope, you can give me some valuable tips.
kind regards, :bigwave:

MiniNik
 
A

Allattar

Within the macro you need to open a layout, and at the end use endlayout to close it. The resulting graphs are then put on the layout page.

Heres an Example

LAYOUT;
TITLE "name the layout".


Histogram C1;
YFrequency;
Bar;
FIGURE 0 0.5 0 0.5.

Boxplot C1;
IQRBox;
Outlier;
FIGURE 0 0.5 0.5 1.

TSPlot C1;
Symbol;
Connect;
FIGURE 0.5 1 0 0.5.

XbarChart C1 5;
FIGURE 0.5 1 0.5 1.

ENDLAYOUT

Highlighted in the above are the commands you really need to use. The figure subcommand can be added to a graph to position the graph on the page, the structure of the subcommand is
figure Xstart Xend Ystart Yend.

The X axis starts at 0 on the left, and ends with 1 on the right hand edge of the page.
The Y axis starts at 0 on the bottom of the page and ends at 1 at the top of the page.

Thats it :D, your lucky as this issue came up for me just last week.
 
M

MiniNik

Thanks a lot.
But i'm getting the next error message:

"Histogram C3;
YFrequency;
Bar;
FIGURE 0 0.5 0 0.5.

* ERROR * Extra text is not allowed.

* Remaining subcommands ignored. "

The following i had written in the command line editor:

"LAYOUT;
TITLE "Histogram".
Histogram C3;
YFrequency;
Bar;
FIGURE 0 0.5 0 0.5.
Boxplot C3;
IQRBox;
Outlier;
FIGURE 0 0.5 0.5 1.
TSPlot C3;
Symbol;
Connect;
FIGURE 0.5 1 0 0.5.
XbarChart C3 5;
FIGURE 0.5 1 0.5 1.
ENDLAYOUT"

Any idea what's wrong? :eek: :truce:
 
A

Allattar

Works here when I test it.
Which version of Minitab do you have, these commands run in release 15. I am trying to remember if those layout commands where in release 14 or not, but I never tried to use them in 14.

What are your regional settings?
Commands in the command line editor can go a bit odd if your regional settings are using different values as list or numeric seperators. I think they should work ok in a global macro though.

EDIT:
Got it, I read your public profile, your location is Germany, and hence your decimal seperator is ,

Change the commands to.

"LAYOUT;
TITLE "Histogram".
Histogram C3;
YFrequency;
Bar;
FIGURE 0 0,5 0 0,5.
Boxplot C3;
IQRBox;
Outlier;
FIGURE 0 0,5 0,5 1.
TSPlot C3;
Symbol;
Connect;
FIGURE 0,5 1 0 0,5.
XbarChart C3 5;
FIGURE 0,5 1 0,5 1.
ENDLAYOUT"
 
M

MiniNik

Minitab release 14.20 installed.
Ok, i've just read your edit... :biglaugh::magic::bonk:i although had to see that with point vs comma.


That was a very easy solution to the error message. Tank you veeeerrry verryyy much, it works, great, wonderful, beautiful, absolutely fantastic!!!:thanks::thanx::applause:*chapeau* i hope, i can help you the next time, but sadly i've just begun working with macros, so it could last a little time... :p
 
M

MiniNik

Another question:

Error Message:

Capa 'C2' 1;
Mu 19;
Lspec 16,2;
Uspec 21,9;
Pooled;
AMR;
UnBiased;
Toler 6;
Within;
Overall;
CStat;
FIGURE 0 0,5 0 0,5.
* Completion of computation impossible.

Can me anybody tell what's wrong with this? :confused:

My input was:

"LAYOUT;
TITLE "Data analysis C2".
Capa 'C2' 1;
Mu 19;
Lspec 16,2;
Uspec 21,9;
Pooled;
AMR;
UnBiased;
Toler 6;
Within;
Overall;
CStat;
FIGURE 0 0,5 0 0,5.
Boxplot C3;
IQRBox;
Outlier;
FIGURE 0 0,5 0,5 1.
TSPlot C3;
Symbol;
Connect;
FIGURE 0,5 1 0 0,5.
XbarChart C3 5;
FIGURE 0,5 1 0,5 1.
ENDLAYOUT"
 
A

Allattar

Glad it works, wasnt sure that the layout command was in 14. (as opposed to layout on the menu)

It looks to me that the column C2 is enclosed with single quotes. Single quotes refer to column names, not numbers so it should be

CAPA c2 1;

But heres the other thing, the figure command doesnt work with the capability command. I think its an issue of non updating graphs, I even tried the DATA subcommand which works to reposition the data region on a graph.

eg: DATA xstart xend ystart yend is used to position the data part of the graph in the graph region, where figure places the grah region on the page.

Capa doesnt like that either.

It may be easier to use the Histogram command, and add reference lines to the histogram instead.

Heres a neat trick, create a histogram, add reference lines from the right click menu. Then go to editor and copy command language, the editing you made to the chart is copied with the commands so you can paste it into the macro.


So unless anyone knows of any other commands that will reposition the graph, capability on that layout might be difficult from the capa command.

I have found a method though of building the capability measures from the capa command back into another graph.
You have to store the information you want, like Cpk.
Convert the value to a text column
text c10 c10
Store the text column in a constant
let k1 = c10(1)
Write the constant as a text table in the graph.

using a subcommand of
text -5 30 k1
With a graph command will add the cpk written to the worksheet onto the graph at coordinates -5 30.

I use that copy command language trick to find the commands I want and then play with the positioning.
 
M

MiniNik

thank you for your information. when you don't know it, you can drive yourself crazy on the try to find a solution for this...:mad::biglaugh:
 
M

MiniNik

hmmmm... it's annoying that many other plots aren't adaptable automaticly. Isn't it possible to write in a macro: click this button then click this and so on? If so: How can i get the program invocations (especially from the layout-tool)?
 
Last edited by a moderator:
C

candid

Naming the created "LAYOUT" graph..?

Hello,

I have some macros that I run quite often that grabs data from our database, puts up some nice layouts..

Now when I plan to make this public, and let other people start using it themselfs, first problem I ran into was that all the Layouts created in the "Graph folder" are ALL called LAYOUT..

Can i within the Layout command, add something to name the Graph?
I am not talking about the small Titles, those I have figured out.

Here is one of my Layout commands:

LAYOUT;
TITLE "OP60 M3".
XbarChart 'BEN1_OP60M3 (mm)' 10;
Stamp 'BEN1_TID';
Test 1 2 3;
FIGURE 0 0,33 0,5 1.
XbarChart 'BEN2_OP60M3 (mm)' 10;
Stamp 'BEN2_TID';
Test 1 2 3;
FIGURE 0,33 0,67 0,5 1.
XbarChart 'BEN3_OP60M3 (mm)' 10;
Stamp 'BEN3_TID';
Test 1 2 3;
FIGURE 0,67 1 0,5 1.
XbarChart 'BEN4_OP60M3 (mm)' 10;
Stamp 'BEN4_TID';
Test 1 2 3;
FIGURE 0 0,33 0 0,5.
XbarChart 'BEN5_OP60M3 (mm)' 10;
Stamp 'BEN5_TID';
Test 1 2 3;
FIGURE 0,33 0,67 0 0,5.
XbarChart 'BEN6_OP60M3 (mm)' 10;
Stamp 'BEN6_TID';
Test 1 2 3;
FIGURE 0,67 1 0 0,5.
ENDLAYOUT

Apreciative for any help or tips !:frust:
 
Top Bottom