.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/plot_upset.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_plot_upset.py: Upset Plot =========== IMDB Top 1000 Movies .. GENERATED FROM PYTHON SOURCE LINES 8-41 .. image-sg:: /auto_examples/images/sphx_glr_plot_upset_001.png :alt: plot upset :srcset: /auto_examples/images/sphx_glr_plot_upset_001.png, /auto_examples/images/sphx_glr_plot_upset_001_2_00x.png 2.00x :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /home/docs/checkouts/readthedocs.org/user_builds/marsilea/envs/v0.3.2/lib/python3.10/site-packages/marsilea/upset.py:328: FutureWarning: Downcasting object dtype arrays on .fillna, .ffill, .bfill is deprecated and will change in a future version. Call result.infer_objects(copy=False) instead. To opt-in to the future behavior, set `pd.set_option('future.no_silent_downcasting', True)` df = pd.DataFrame(sets).fillna(False).astype(int) /home/docs/checkouts/readthedocs.org/user_builds/marsilea/envs/v0.3.2/lib/python3.10/site-packages/marsilea/plotter/_seaborn.py:108: FutureWarning: Passing `palette` without assigning `hue` is deprecated and will be removed in v0.14.0. Assign the `x` variable to `hue` and set `legend=False` for the same effect. plotter(data=pdata, orient=orient, ax=ax, **options) | .. code-block:: Python from matplotlib import pyplot as plt import marsilea as ma from marsilea.upset import UpsetData, Upset imdb = ma.load_data("imdb") items_attrs = (imdb[['Title', 'Year', 'Runtime (Minutes)', 'Rating', 'Votes', 'Revenue (Millions)', 'Metascore']] .set_index('Title')) upset_data = UpsetData.from_memberships(imdb.Genre.str.split(','), items_names=imdb['Title'], items_attrs=items_attrs) us = Upset(upset_data, min_cardinality=15) us.highlight_subsets(min_cardinality=48, facecolor="#D0104C", label="Larger than 48") us.highlight_subsets(min_cardinality=32, edgecolor="green", edgewidth=1.5, label="Larger than 32") us.add_items_attr("bottom", "Revenue (Millions)", "strip", pad=.2, size=.5, plot_kws=dict(palette="dark:#24936E", size=1.2, label="")) us.add_title(bottom="Revenue (Millions)", fontsize=10) us.add_items_attr("top", "Rating", "box", pad=.2, plot_kws=dict(color="orange", linewidth=1, fliersize=1)) us.add_title(top="Rating", fontsize=10) us.add_legends(box_padding=0) us.set_margin(.3) us.render() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 2.695 seconds) .. _sphx_glr_download_auto_examples_plot_upset.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_upset.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_upset.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_