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

Semicon wafer map plot. How to I fix error?

Names Default To Here(1);

// Function to recode a selected column
recode_column = Function({dataTable, columnToRecode, newColumnName},
    // Check if column exists
    If(Column(dataTable, columnToRecode) != {},
        // Create a mapping for recoding
        aa_recode = Associative Array();
        For(i = 1, i <= N Row(dataTable), i++,
            aa_recode[Column(dataTable, columnToRecode) << Get Value(i)] = Column(dataTable, columnToRecode) << Get Value(i);
        );
        dataTable << New Column(newColumnName, Character, Nominal, << Set Each Value(
            aa_recode[Column(dataTable, columnToRecode)]
        ));
        cols = {};
        For(i = 1, i <= N Col(dataTable), i++,
            cols[N Items(cols) + 1] = Column(dataTable, i) << Get Name
        );
        recodeColListBox << Set Items(cols);
        colorColListBox << Set Items(cols); // Refresh heatmap plotting list
        Show Message("Column recoded and new column added: " || newColumnName);
    ,
        Show Message("Selected column does not exist.")
    );
);

// Function to plot the heatmap
PlotHeatmap = Function({dataTable, colorColumnName},
    If(colorColumnName != "",
        Graph Builder(
            Size(1500, 800),
            Show Control Panel(0),
            Data Table(dataTable),
            Variables(
                X(:x_Location),
                Y(:y_Location),
                Color(Column(dataTable, colorColumnName))
            ),
            Elements(Heatmap(X, Y, Legend(4)))
        )
    ,
        Show Message("Please select a column for color.")
    )
);

list = {};
For(i = 1, i <= N Table(), i++,
    list[i] = Data Table(i) << Get Name
);

// Create the window
win = New Window("JMP ADDIN",
    H List Box(
        V List Box(
            Panel Box("Choose a source data table",
                dtListBox = List Box(list, max selected(1))
            )
        ),
        
        Button Box("Get Columns",
            chosen = Data Table((dtListBox << Get Selected)[1]);
            If(chosen != {},
                cols = {};
                For(i = 1, i <= N Col(chosen), i++,
                    cols[N Items(cols) + 1] = Column(chosen, i) << Get Name
                );
                recodeColListBox << Set Items(cols);
                colorColListBox << Set Items(cols); // Refresh for heatmap plotting
            ,
                Show Message("Please select a valid data table.")
            );
        ),
        
        // Panel for selecting columns to recode
        V List Box(
            Panel Box("Select Columns for Recode",
                recodeColListBox = List Box("")
            )
        ),
        
        // Button to recode a column
        Button Box("Recode Column",
            chosen = Data Table((dtListBox << Get Selected)[1]);
            recode_col = recodeColListBox << Get Selected;
            If(recode_col != "",
                new_col_name = "Recode_" || recode_col; // Define new column name
                recode_column(chosen, recode_col, new_col_name);
                // Refresh column list after recoding
                cols = {};
                For(i = 1, i <= N Col(chosen), i++,
                    cols[N Items(cols) + 1] = Column(chosen, i) << Get Name
                );
                recodeColListBox << Set Items(cols);
                colorColListBox << Set Items(cols); // Ensure the new column is available for heatmap plotting
            ,
                Show Message("Please select a column to recode.")
            );
        ),
        
        // Panel for selecting columns to plot heatmap
        V List Box(
            Panel Box("Select Columns for Heatmap",
                colorColListBox = List Box("")
            )
        ),
        
        // Button to plot the heatmap
        Button Box("Plot Heatmap",
            selectedColorColumn = colorColListBox << Get Selected;
            If(selectedColorColumn != "",
                chosen = Data Table((dtListBox << Get Selected)[1]);
                If(chosen != {},
                    PlotHeatmap(chosen, selectedColorColumn);
                ,
                    Show Message("Selected data table is invalid.")
                );
            ,
                Show Message("Please select a column for color.")
            );
        )
    )
);

WorkFlow: Select Table--> Select Column to Recode--> Recode column(need help to allow recoding for both character and numerical column)--->Refresh column list--> select one or many columns --> Plot Heat Map
Need Help 1) debug the currect script where i can recode only numeric data type columns
2) How to include selection of Character type columns to recode?
3) Can I otherwise open the recode ui preset by jmp(columns--> Recode) as part of the ui?

17 REPLIES 17
jthi
Super User

Re: Semicon wafer map plot. How to I fix error?

This code looks like it has been created by some LLM so there are plenty of small mistakes and utilization of functions which JMP doesn't have. Could you provide an example table which also contains the correct result and explanation where it is coming from.

-Jarmo

Re: Semicon wafer map plot. How to I fix error?

DecileIbex201_0-1724290274451.png

This the example- you recode 'lot no' to group it and the plot heat map using the 'recoded column'

DecileIbex201_1-1724290394666.png

Example 2: testers are grouped and then the Heatmap is plot using the recoded column

Hope this helps

Thanks

jthi
Super User

Re: Semicon wafer map plot. How to I fix error?

What is the grouping based on? Consecutive rows?

-Jarmo

Re: Semicon wafer map plot. How to I fix error?

Yes or using the recoded column
Eg where :recoded column=1( thus grouping tester 1 and 2)
jthi
Super User

Re: Semicon wafer map plot. How to I fix error?

I'm still not sure how tester 3 is supposed to turn into 2 or what type of heatmap you are looking from just these two columns

jthi_0-1724298977432.pngjthi_1-1724298984463.png

jthi_2-1724298991689.pngjthi_3-1724299004760.png

 

 

 

-Jarmo

Re: Semicon wafer map plot. How to I fix error?

recoded column can be placed as page(:recoded column) I need help on how to trigger recode of selected column and then add it to list of columns when refreshed
jthi
Super User

Re: Semicon wafer map plot. How to I fix error?

So you wish to have an UI which is able to

  • Let user select column(s)
  • Trigger JMP's recode platform on the selected column(s)
  • Prevent user from using in-place operation
  • Detect which new columns were created
  • Create plot based on the newly created columns

?

-Jarmo

Re: Semicon wafer map plot. How to I fix error?

Yes!
jthi
Super User

Re: Semicon wafer map plot. How to I fix error?

This might not be as simple as you think if you want to let users freely use the recode platform.

-Jarmo