I’d like to create lots of diagrams with python and I have to store the images within a knime-table.
Currently I use a Knime-Chunk-Loop to create with python all these diagrams (several python-views per row)
So I would prefer, to have one single pyhton-node, which creates the diagrams and put it into the dataframe.
This is the current python-script (does not work):
from io import BytesIO
import pandas as pd
import matplotlib.pylab as plt
data = input_table.copy()
for i, r in data.iterrows():
buffer = BytesIO()
data.at[i, 'diag1'] = buffer.getvalue()
output_table = data
Does anyone have an idea?
How about you add an image to table at the end of every Image produced and collect them thru the loop end node?
Yes one downside is you maybe would have to use a loop outside python.
this is my current solution. but i would prefer to do all within one single python-node - cause this is much faster (every call on python-nodes need seconds, even if there are view data)…
OK next idea would be to store the images in a subfolder from Python and then use KNIME to loop over them and put them in a KNIME table. Admittedly not the most elegant way.
This entry might be worth exploring:
hm, not elegant, but possible. I’ll try…
If I use
I’ll get the html-code of the svg-image into the knime-table at least…
Here is the solution:
Now you can use the “string to svg”-Node, then you can see the image…
In the example on top there is a way to directly export images from Python to PNG
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.