From c16ea7bf4a870de48191b2a03f58c335f55f9a52 Mon Sep 17 00:00:00 2001 From: Joel Nothman Date: Sun, 31 Dec 2023 00:07:32 +1100 Subject: [PATCH 1/2] Organise examples (#265) --- doc/conf.py | 2 ++ examples/plot_customize_after_plot.py | 6 +++--- examples/plot_diabetes.py | 8 ++++---- examples/plot_discrete.py | 6 +++--- examples/plot_generated.py | 6 +++--- examples/plot_hide.py | 6 +++--- examples/plot_highlight.py | 6 +++--- examples/plot_highlight_categories.py | 6 +++--- examples/plot_missingness.py | 6 +++--- examples/plot_sizing.py | 6 +++--- examples/plot_theming.py | 6 +++--- examples/plot_vertical.py | 6 +++--- 12 files changed, 36 insertions(+), 34 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index 22b8c97..d4b40f2 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -30,6 +30,7 @@ ) import sphinx_rtd_theme # noqa +from sphinx_gallery.sorting import ExampleTitleSortKey # noqa from upsetplot import __version__ as release # noqa @@ -284,4 +285,5 @@ # path where to save gallery generated examples "gallery_dirs": "auto_examples", "backreferences_dir": "_modules", + "within_subsection_order": ExampleTitleSortKey, } diff --git a/examples/plot_customize_after_plot.py b/examples/plot_customize_after_plot.py index 45a06d5..4eef807 100644 --- a/examples/plot_customize_after_plot.py +++ b/examples/plot_customize_after_plot.py @@ -1,7 +1,7 @@ """ -======================= -Customizing axis labels -======================= +=============================== +Design: Customizing axis labels +=============================== This example illustrates how the return value of the plot method can be used to customize aspects of the plot, such as axis labels, legend position, etc. diff --git a/examples/plot_diabetes.py b/examples/plot_diabetes.py index eead980..cd06fa7 100644 --- a/examples/plot_diabetes.py +++ b/examples/plot_diabetes.py @@ -1,7 +1,7 @@ """ -================================== -Above-average features in Diabetes -================================== +========================================== +Data Vis: Feature distribution in Diabetes +========================================== Explore above-average attributes in the Diabetes dataset (Efron et al, 2004). @@ -73,5 +73,5 @@ upset.add_catplot(value="progression", kind="strip", color="blue") upset.add_catplot(value="bmi", kind="strip", color="black") upset.plot() -plt.title("UpSet with catplots, for orientation='vertical'") +plt.suptitle("UpSet with catplots, for orientation='vertical'") plt.show() diff --git a/examples/plot_discrete.py b/examples/plot_discrete.py index 3853d64..1216cd0 100644 --- a/examples/plot_discrete.py +++ b/examples/plot_discrete.py @@ -1,7 +1,7 @@ """ -================================================= -Plotting discrete variables as stacked bar charts -================================================= +=========================================================== +Data Vis: Plotting discrete variables as stacked bar charts +=========================================================== Currently, a somewhat contrived example of `add_stacked_bars`. """ diff --git a/examples/plot_generated.py b/examples/plot_generated.py index b14fdce..2040180 100644 --- a/examples/plot_generated.py +++ b/examples/plot_generated.py @@ -1,7 +1,7 @@ """ -============================ -Plotting with generated data -============================ +=================================== +Basic: Plotting with generated data +=================================== This example illustrates basic plotting functionality using generated data. """ diff --git a/examples/plot_hide.py b/examples/plot_hide.py index 48bf874..c4aff8b 100644 --- a/examples/plot_hide.py +++ b/examples/plot_hide.py @@ -1,7 +1,7 @@ """ -====================================== -Hiding subsets based on size or degree -====================================== +============================================= +Basic: Hiding subsets based on size or degree +============================================= This illustrates the use of ``min_subset_size``, ``max_subset_size``, ``min_degree`` or ``max_degree``. diff --git a/examples/plot_highlight.py b/examples/plot_highlight.py index bccc332..cb801ab 100644 --- a/examples/plot_highlight.py +++ b/examples/plot_highlight.py @@ -1,7 +1,7 @@ """ -============================= -Highlighting selected subsets -============================= +======================================= +Data Vis: Highlighting selected subsets +======================================= Demonstrates use of the `style_subsets` method to mark some subsets as different. diff --git a/examples/plot_highlight_categories.py b/examples/plot_highlight_categories.py index eae84d9..27c8ad1 100644 --- a/examples/plot_highlight_categories.py +++ b/examples/plot_highlight_categories.py @@ -1,7 +1,7 @@ """ -================================ -Highlighting selected categories -================================ +========================================== +Data Vis: Highlighting selected categories +========================================== Demonstrates use of the `style_categories` method to mark some categories differently. diff --git a/examples/plot_missingness.py b/examples/plot_missingness.py index c7120a3..cff9b9f 100644 --- a/examples/plot_missingness.py +++ b/examples/plot_missingness.py @@ -1,7 +1,7 @@ """ -======================================= -Plot the distribution of missing values -======================================= +============================================== +Basic: Plot the distribution of missing values +============================================== UpSet plots are often used to show which variables are missing together. diff --git a/examples/plot_sizing.py b/examples/plot_sizing.py index a512eef..397884e 100644 --- a/examples/plot_sizing.py +++ b/examples/plot_sizing.py @@ -1,7 +1,7 @@ """ -======================================== -Customising element size and figure size -======================================== +================================================ +Design: Customising element size and figure size +================================================ This example illustrates controlling sizing within an UpSet plot. """ diff --git a/examples/plot_theming.py b/examples/plot_theming.py index f4331d2..b3afe87 100644 --- a/examples/plot_theming.py +++ b/examples/plot_theming.py @@ -1,7 +1,7 @@ """ -==================== -Changing Plot Colors -==================== +============================ +Design: Changing Plot Colors +============================ This example illustrates use of matplotlib and upsetplot color settings, aside from matplotlib style sheets, which can control colors as well as grid lines, diff --git a/examples/plot_vertical.py b/examples/plot_vertical.py index 2e49a58..c41692e 100644 --- a/examples/plot_vertical.py +++ b/examples/plot_vertical.py @@ -1,7 +1,7 @@ """ -==================== -Vertical orientation -==================== +=========================== +Basic: Vertical orientation +=========================== This illustrates the effect of orientation='vertical'. """ From b380d07ac45f860876b5ead95129902a9f0cb6f7 Mon Sep 17 00:00:00 2001 From: Joel Nothman Date: Sun, 31 Dec 2023 11:49:48 +1100 Subject: [PATCH 2/2] Improve docstring for totals_plot_elements=0 (#263) --- upsetplot/plotting.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/upsetplot/plotting.py b/upsetplot/plotting.py index 3d5630f..8b99712 100644 --- a/upsetplot/plotting.py +++ b/upsetplot/plotting.py @@ -254,7 +254,10 @@ class UpSet: Setting to 0 is handled. totals_plot_elements : int The totals plot should be large enough to fit this many matrix - elements. Use totals_plot_elements=0 to disable the totals plot. + elements. Set to 0 to disable the totals plot. + + .. versionchanged:: 0.9 + Setting to 0 is handled. show_counts : bool or str, default=False Whether to label the intersection size bars with the cardinality of the intersection. When a string, this formats the number.