Loop within a loop on the columns

I am attempting to loop over all pairs of columns for my data set, and to make a scatter plot of each of these pairs. I want to save them to a table and then view the table all at once. I’ve been able to get it to work with a single loop, which creates a table of scatterplots all x by x pairs. For example, I have a year column in my data set, and so I get a scatterplot in my table that is year by year. However, I can’t find a way to extrapolate this to create the other scatterplots. Any help would be greatly appreciated.

To expand upon this, What I essentially want is to do the following:
for col_x in columns:
__for col_y in columns:
____plot(col_x, col_y)

Hi @madisonk, I’m not sure if I’m fully understanding but if, as it appears in the example loops you have given, what you are looking at here is all values of y for all values of x, then this is effectively a cross join, so if you split your data set into x and y, and then join the two together with a Cross Joiner node, this should give you a table containing all the required pairs of values from which to do your plotting.

If that doesn’t help, are you able to post a simple example workflow showing what you have got working so far, and somebody can more easily assist.

2 Likes

Hi @madisonk and welcome to KNIME

See this wf loop_columns.knwf (54.2 KB). It takes one column from the dataset and creates scatterplots against all other columns in your data set.


image
gr. Hans

6 Likes

That’s a really nice sample workflow @HansS. I’ve not done much with plotting in KNIME so I found this to be a really useful demo… :grinning:

3 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.