Icon

kn_​example_​python_​graphic_​boxenplot_​large_​distribution_​46

KNIME & Python Graphics - Boxenplot Plotting large distributions - using the bundled Python integration (KNIME 4.6+)

KNIME & Python Graphics - Boxenplot Plotting large distributions - using the bundled Python integration (KNIME 4.6+)

adapted from: https://seaborn.pydata.org/examples/large_distributions.html
on the KNIME hub: https://kni.me/w/nbfX818PlGRUflhK

YouTube - Advanced Visualizations with Python and KNIME also a data app
https://youtu.be/mG2SZiKG9zo?t=2108

MEDIUM: Create an Interactive Dashboard with KNIME Components and Python
https://medium.com/p/41ef794b1467

KNIME & Python Graphics - Boxenplot Plotting large distributions - using the bundled Python integration (KNIME 4.6+)adapted from: https://seaborn.pydata.org/examples/large_distributions.htmlon the KNIME hub: https://kni.me/w/nbfX818PlGRUflhK import knime.scripting.io as knio#Import Libraryfrom io import BytesIOimport osimport pandas as pdimport seaborn as snssns.set_theme(style="whitegrid")# https://seaborn.pydata.org/examples/large_distributions.htmlinput_table = knio.input_tables[0].to_pandas()var_title = knio.flow_variables['title_graphic']var_footnote = knio.flow_variables['footnote_graphic']var_colour = knio.flow_variables['v_colour']var_x_variable = knio.flow_variables['variable_x']var_x_label = knio.flow_variables['label_x']var_y_a_variable = knio.flow_variables['variable_y_a']var_y_a_label = knio.flow_variables['label_y_a']var_kind_scale = knio.flow_variables['v_kind_scale']# set the rank ordervar_rank_order_x = knio.flow_variables['rank_order_x']var_rank_order_x2 = [str(x.strip()) for x in var_rank_order_x.split(',') if x]# var_rank_order_x2 = ["I1", "SI2", "SI1", "VS2", "VS1", "VVS2", "VVS1", "IF"]#define figure size# sns.set(rc={"figure.figsize":(16, 9)}) #width=8, height=4sns.set(rc={'figure.figsize':(16,9)})################################################### https://seaborn.pydata.org/examples/large_distributions.htmlg = sns.boxenplot(x=var_x_variable, y=var_y_a_variable, color=var_colour, order=var_rank_order_x2, scale="linear", data=input_table)g.set(xlabel=var_x_label, ylabel=var_y_a_label, title=var_title)##################################################fig_out = g.get_figure()fig_out.set_size_inches(16, 9)fig_out.text(0.1, 0.025, var_footnote ,fontsize=10)#add overall title# g.fig.suptitle(var_title)# Create buffer to write intobuffer = BytesIO()# Create plot and write it into the bufferfig_out.savefig(buffer, format='svg')# The output is the content of the bufferoutput_image = buffer.getvalue()knio.output_images[0] = output_image determine an additional sorting system Interactive data app YouTube - Advanced Visualizations with Python and KNIME also a data apphttps://youtu.be/mG2SZiKG9zo?t=2108 Interactive data app - with the new Python View node MEDIUM: Create an Interactive Dashboard with KNIME Components and Pythonhttps://medium.com/p/41ef794b1467 1.920 x 1.080PNG filefrom_knime_boxenplot_large_distribution.pngdiamonds.parquetright mouse clickto set the parametersavg priceper Clarityavg priceper Clarityavg priceper Clarityrank_order_xrank_order_xkn_var_graphic_titleEnter a Title from outside via Flow Variablefrom_knime_boxenplot_large_distribution_2.png1.920 x 1.080PNG fileright mouse clickto set the parametersprepare a sorting logiclist all string and numeric variables to be used in dopdown listsIneractive VIEWwith Python graphics(right click)1.920 x 1.080PNG filefrom_knime_boxenplot_large_distribution_3.pngfrom_knime_boxenplot_large_distribution_3.png1.920 x 1.080PNG fileIneractive VIEWwith Python graphics(right click)"png_path"extract the name of thePNG selected in the component Image To Table Renderer to Image Table To Image Image Writer (Port) Parquet Reader Python graphics - BoxenplotPlotting large distributions GroupBy Sorter GroupBy Column Rename Table Rowto Variable Java EditVariable (simple) Image To Table Image Writer (Port) Renderer to Image Python graphics - BoxenplotPlotting large distributions Table To Image Additional datapreparations Image To Table Python graphics interactive - BoxenplotPlotting large distributions Renderer to Image Table To Image Image Writer (Port) Image Writer (Port) Renderer to Image Table To Image Image To Table Python graphics interactive - BoxenplotPlotting large distributions Create File/FolderVariables KNIME & Python Graphics - Boxenplot Plotting large distributions - using the bundled Python integration (KNIME 4.6+)adapted from: https://seaborn.pydata.org/examples/large_distributions.htmlon the KNIME hub: https://kni.me/w/nbfX818PlGRUflhK import knime.scripting.io as knio#Import Libraryfrom io import BytesIOimport osimport pandas as pdimport seaborn as snssns.set_theme(style="whitegrid")# https://seaborn.pydata.org/examples/large_distributions.htmlinput_table = knio.input_tables[0].to_pandas()var_title = knio.flow_variables['title_graphic']var_footnote = knio.flow_variables['footnote_graphic']var_colour = knio.flow_variables['v_colour']var_x_variable = knio.flow_variables['variable_x']var_x_label = knio.flow_variables['label_x']var_y_a_variable = knio.flow_variables['variable_y_a']var_y_a_label = knio.flow_variables['label_y_a']var_kind_scale = knio.flow_variables['v_kind_scale']# set the rank ordervar_rank_order_x = knio.flow_variables['rank_order_x']var_rank_order_x2 = [str(x.strip()) for x in var_rank_order_x.split(',') if x]# var_rank_order_x2 = ["I1", "SI2", "SI1", "VS2", "VS1", "VVS2", "VVS1", "IF"]#define figure size# sns.set(rc={"figure.figsize":(16, 9)}) #width=8, height=4sns.set(rc={'figure.figsize':(16,9)})################################################### https://seaborn.pydata.org/examples/large_distributions.htmlg = sns.boxenplot(x=var_x_variable, y=var_y_a_variable, color=var_colour, order=var_rank_order_x2, scale="linear", data=input_table)g.set(xlabel=var_x_label, ylabel=var_y_a_label, title=var_title)##################################################fig_out = g.get_figure()fig_out.set_size_inches(16, 9)fig_out.text(0.1, 0.025, var_footnote ,fontsize=10)#add overall title# g.fig.suptitle(var_title)# Create buffer to write intobuffer = BytesIO()# Create plot and write it into the bufferfig_out.savefig(buffer, format='svg')# The output is the content of the bufferoutput_image = buffer.getvalue()knio.output_images[0] = output_image determine an additional sorting system Interactive data app YouTube - Advanced Visualizations with Python and KNIME also a data apphttps://youtu.be/mG2SZiKG9zo?t=2108 Interactive data app - with the new Python View node MEDIUM: Create an Interactive Dashboard with KNIME Components and Pythonhttps://medium.com/p/41ef794b1467 1.920 x 1.080PNG filefrom_knime_boxenplot_large_distribution.pngdiamonds.parquetright mouse clickto set the parametersavg priceper Clarityavg priceper Clarityavg priceper Clarityrank_order_xrank_order_xkn_var_graphic_titleEnter a Title from outside via Flow Variablefrom_knime_boxenplot_large_distribution_2.png1.920 x 1.080PNG fileright mouse clickto set the parametersprepare a sorting logiclist all string and numeric variables to be used in dopdown listsIneractive VIEWwith Python graphics(right click)1.920 x 1.080PNG filefrom_knime_boxenplot_large_distribution_3.pngfrom_knime_boxenplot_large_distribution_3.png1.920 x 1.080PNG fileIneractive VIEWwith Python graphics(right click)"png_path"extract the name of thePNG selected in the component Image To Table Renderer to Image Table To Image Image Writer (Port) Parquet Reader Python graphics - BoxenplotPlotting large distributions GroupBy Sorter GroupBy Column Rename Table Rowto Variable Java EditVariable (simple) Image To Table Image Writer (Port) Renderer to Image Python graphics - BoxenplotPlotting large distributions Table To Image Additional datapreparations Image To Table Python graphics interactive - BoxenplotPlotting large distributions Renderer to Image Table To Image Image Writer (Port) Image Writer (Port) Renderer to Image Table To Image Image To Table Python graphics interactive - BoxenplotPlotting large distributions Create File/FolderVariables

Nodes

Extensions

Links