#!/usr/bin/env python # coding: utf-8 # In[1]: get_ipython().run_line_magic('matplotlib', 'inline') # # Enrichment Plot # A function to plot step plots of cumulative counts. # > from mlxtend.general_plotting import category_scatter # ## Overview # In enrichment plots, the y-axis can be interpreted as "how many samples are less or equal to the corresponding x-axis label." # ### References # # - - # ## Example 1 - Enrichment Plots from Pandas DataFrames # In[2]: import pandas as pd s1 = [1.1, 1.5] s2 = [2.1, 1.8] s3 = [3.1, 2.1] s4 = [3.9, 2.5] data = [s1, s2, s3, s4] df = pd.DataFrame(data, columns=['X1', 'X2']) df # Plotting the data where the categories are determined by the unique values in the label column `label_col`. The `x` and `y` values are simply the column names of the DataFrame that we want to plot. # In[3]: import matplotlib.pyplot as plt from mlxtend.plotting import enrichment_plot ax = enrichment_plot(df, legend_loc='upper left') # ## API # In[4]: with open('../../api_modules/mlxtend.plotting/enrichment_plot.md', 'r') as f: print(f.read())