Displaying the graph in Knime

Hello all. I created a node Python view to display information. But i don’t see graph on the tab Image, next to flow variables. Probably there is a problem with script, i write the part of it below.

models.sort(key=lambda x: x[‘r2’], reverse=True)

plt.figure(figsize=(800 / 80, 600 / 80), dpi=80)
top_variable_names = [“, “.join(model[‘variables’]) for model in models[:5]]
top_r2_values = [model[‘r2’] for model in models[:5]]
plt.barh(top_variable_names, top_r2_values, height=0.4)
plt.xlabel(“R-squared”)
plt.ylabel(“Variables”)
plt.title(“Top 5 Models and their R-squared”)
for i, v in enumerate(top_r2_values):
plt.text(v + 0.01, i, f”{v:.2f}”, va=‘center’)

plt.tight_layout()
fig = plt.figure()
knio.output_view = knio.view(fig)
Models is an dictionary array

Hi @mak_782 -

Any chance you could upload the workflow itself instead, along with the data, so that others could help you better troubleshoot?

3 Likes

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