From 24829da9f48daa9ef2a01802dcd0348bc272bd62 Mon Sep 17 00:00:00 2001 From: Will Robertson Date: Mon, 25 Mar 2024 22:02:58 +1030 Subject: [PATCH] doc --- docs/sankey_doc_examples.py | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/docs/sankey_doc_examples.py b/docs/sankey_doc_examples.py index 279f2f7..528c43b 100644 --- a/docs/sankey_doc_examples.py +++ b/docs/sankey_doc_examples.py @@ -9,6 +9,7 @@ sky.sankey(data) plt.show() plt.savefig("fruits_default.png") +plt.close() data = pd.DataFrame( [ @@ -36,6 +37,7 @@ sky.sankey(data, colormap="jet") plt.show() plt.savefig("fruits_jet.png") +plt.close() color_dict = {"apple": "#f71b1b", "blueberry": "#1b7ef7", "banana": "#f3f71b", "lime": "#12e23f", "orange": "#f78c1b"} @@ -43,6 +45,7 @@ sky.sankey(data, color_dict=color_dict) plt.show() plt.savefig("fruits_colordict.png") +plt.close() label_dict = {"apple": "Apple", "blueberry": "B'berry", "banana": "Banana", "lime": "Lime", "orange": "Orange"} @@ -50,31 +53,38 @@ sky.sankey(data, label_dict=label_dict) plt.show() plt.savefig("fruits_labeldict.png") +plt.close() + plt.figure() sky.sankey(data, flow_alpha=0.3) plt.show() plt.savefig("fruits_alpha.png") +plt.close() plt.figure() sky.sankey(data, sort="top") plt.show() plt.savefig("fruits_sort_top.png") +plt.close() plt.figure() sky.sankey(data, sort="bottom") plt.show() plt.savefig("fruits_sort_bot.png") +plt.close() plt.figure() sky.sankey(data, sort="none") plt.show() plt.savefig("fruits_sort_none.png") +plt.close() plt.figure() sky.sankey(data, titles=["Summer", "Winter"]) plt.show() plt.savefig("fruits_titles.png") +plt.close() plt.figure() sky.sankey( @@ -84,6 +94,7 @@ ) plt.show() plt.savefig("fruits_titles_bottom.png") +plt.close() plt.figure() sky.sankey(data, @@ -93,6 +104,7 @@ ) plt.show() plt.savefig("fruits_titles_outer.png") +plt.close() plt.figure() sky.sankey(data, @@ -103,6 +115,7 @@ ) plt.show() plt.savefig("fruits_fonts.png") +plt.close() plt.figure(dpi=600) sky.sankey( @@ -117,16 +130,19 @@ ) plt.show() plt.savefig("data3_fonts_fancy.png") +plt.close() plt.figure() sky.sankey(data, valign="center") plt.show() plt.savefig("fruits_valign.png") +plt.close() plt.figure() sky.sankey(data, frame_side="both") plt.show() plt.savefig("fruits_frame.png") +plt.close() plt.figure() sky.sankey(data, @@ -135,6 +151,7 @@ ) plt.show() plt.savefig("fruits_frame_color.png") +plt.close() plt.figure() sky.sankey( @@ -154,6 +171,7 @@ ) plt.show() plt.savefig("fruits_spacing.png") +plt.close() data = pd.DataFrame( [ @@ -170,7 +188,7 @@ plt.figure() sky.sankey(data, sort="top", colormap="jet", aspect=0.5) plt.savefig("frame2_sort_n1.png") - +plt.close() color_dict = { "a": "#f71b1b", @@ -191,7 +209,7 @@ valign="center", ) plt.savefig("frame3_pretty.png") - +plt.close() plt.figure(dpi=600) sky.sankey( @@ -199,7 +217,7 @@ label_loc=["right","right","left"], ) plt.savefig("frame3_labels.png") - +plt.close() plt.figure(dpi=600) @@ -212,7 +230,7 @@ label_gap=0.02, node_width=0.05, node_gap=0.02, - alpha=0.3, + flow_alpha=0.3, titles=["Stage 1", "Stage 2", "Stage 3"], title_gap=0.05, title_side="both", @@ -222,7 +240,7 @@ ) plt.savefig("frame3_many.png") - +plt.close() plt.figure(dpi=600) sky.sankey(data3, @@ -235,3 +253,9 @@ flow_lw = 1, ) plt.savefig("frame3_edge.png") +plt.close() + + + + +