Loop for violin plot batch generation

Hi All,

I have a file with 48 numerical columns, some other columns I’m not interested in right now, and data is grouped in 4 groups as coded in a column. I want to do a violin plot for each column, representing all 4 groups. I can do one plot for each column without any problems. Now I’m trying to use a loop to generate one single image for all 48 violin plots, but somehow it doesn’t work.
I’ve put a column list loop start (where I had to put all columns in the exclude part, because if I put them in the include they will be filtered out, no idea why, and no violin plot would come out). Then my violin plot node, an image to table node, and a loop end (column append) node. My output is a table with just the column I selected in the original violin node. No idea why it’s not appending the other columns.

Hi @IriaGomez,
Welcome to the KNIME Forum. Would you mind sharing your workflow (ideally with data, real or fake)? It would make it easier for us to help you.
Kind regards,
Alexander

Hi @AlexanderFillbrunn. I’ve improved it a little bit, as the loop seems to work but still I don’t quite manage to get an exportable image/file with all the violin plots. Testing_violin_batches.knwf (1.7 MB)
Thank you!

Hi,
I changed your workflow a bit. First I use a normal Loop End node instead of the Loop End (Column Append). Then I render the image from SVG to PNG using the Renderer to Image node and finally pass the table to the report using Data to Report. Then in the report, I add a table, bind the image column, insert an image element in the middle cell, choose its type as “Dynamic Image”, pulling the data out of the table’s blob cell. This was nicely described here by @armingrudd. Please find attached the changed workflow. By the way: you can also export all the images separately using the Image Writer.
Kind regards,
Alexander

Testing_violin_batches.knwf (23.5 KB)

4 Likes

Hi @AlexanderFillbrunn, and many thanks for fixing the workflow. I’m new at KNIME (at least to the new version) and I might be missing something from your explanation and that of @armingrudd but, looking on info about the KNIME report designer, it seems that I should have an icon next to the zoom tab to open BIRT, which I don’t have. Therefore, I guess I can’t do anything on the above regarding the modification of the report. My KNIME version is 4.1.2.
Thank you.
Iria

Sorry it sent without finishing. What should I do to be able to see and modify the report as you suggest?
Thanks again

Hi,
you probably have to install the KNIME Report Designer extension for that.
Kind regards,
Alexander

Hi again,

Thanks, I’ve done so and I’ve been able to generate this report. default_report.docx (849.2 KB) However, what I need is all plots arranged so they fit in one page, for example, if there are 37 plots I would like them to be arranged in 8 columns and 5 rows. I hope I’m explaining myself properly, and many thanks for the help.
Kind regards,
Iria

Hi,
I think automatic scaling of the images to dynamically fit onto one page is not possible. Unfortunately I am not sure if a grid view of images is possible. Maybe @armingrudd knows? He seems to be quite knowledgeable about the report designer.
Kind regards,
Alexander

1 Like

Hi @IriaGomez and welcome to the KNIME community forum,

Have you thought about the size of the chart images?? What is your report page size? You should consider these factors then decide how many charts you want to put in a single page.

First of all, think about the page and image sizes and calculate the number of columns (images in the same row) you want to have and apply them in your project.
Then, after creating the column of images, transform the table to have your desired number of columns. You can use Chunk Loop Start and Loop End (Column Append) nodes for that (with the RowID node in the loop). You would have a table with for example 8 columns and 5 rows if you set the number of chunks to 8 in the chunk loop start.
Now create a table with 8 columns in BIRT and bind all image columns. After that, put an image report item in each data cell and assign image columns to image items.

This way you can always use your workflow without having to modify the configurations.

:blush:

3 Likes

Another interesting way to split content of the same type in multiple columns in BIRT is to use a filter based on a mod(x, y) expression (rest of division of x by y, and wher x=rowID and y=nb of columns.
But I like also your solution @armingrudd.

2 Likes

Thank you @szawadski,

Would you please implement it on the provided workflow?
I was going to use filtering in BIRT, but was not sure how to implement it for this case. I’m very interested to learn it from you.

Thanks.
:blush:

2 Likes

Thank you, both @armingrudd and @szawadski. I’ve tried your solution @armingrudd, but somehow I get a report with some rows containing numbers as well as the plots. Don’t judge teh report on the plot size- I haven’t yet selected the right size for themdefault_report_V2.docx (308.4 KB) . I’m new at KNIME report designer, so not sure in how to implement @szawadski 's solution though :slight_smile:

I need first to implement an important job first but I will do it… Just need to wait some days… :wink:

3 Likes

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