Package: dataoutsider
Welcome to the dataoutsider visualization toolbox!Featuring:Multi-Chord DiagramPie-Tree Chart (or Pie-Map Chart)Bubble Series ChartMulti-Chord DiagramHave too many sets for a Venn Diagram?Prepare groups
a. Select 2 fields that identify 1. a group (ex: sports event) and 2. an entity (ex: athlete) to identify the many-to-many relationships (ex: many athletes to many events)
or
b. Pre-group data and provide each unique group combination (ex: athletes that competed in only the [100 meter] vs those that competed in only the [100 meter & 200 meter], etc.) and associated entity count (ex: # of athletes per group)Configure the parent-group orderThe multi-chord diagram will create bonds between many-to-many relationships, sized by the entity count per each unique group combination (ex: 10 athletes competed in only the [50 meter, 100 meter, & meter], 23 athletes competed in only the [100 meter], etc.)Assumes 1 row = 1 unit for 1. a.Example 1 (1. a.):from dataoutsider import multi_chord as mc

df = mc.load_olympics_df()
df = df.loc[(df['Year'] >= 2014) & (df['Sex'] == 'F') & (df['Sport'] == 'Speed Skating')]
outer = 'Event'
inner = 'ID'
lookup = mc.multi_chord_get_alias(df, outer, inner)
print(lookup)
df_mc = mc.multi_chord_alias(df, outer, inner, percent = 75.)

df_mc_venn = mc.multi_chord_venn(df_mc)

mc.multi_chord_plot(df_mc, level = 4, transparency = 0.5)Example 2 (1. b.):from dataoutsider import multi_chord as mc
import pandas as pd

data = [['a', 25.5], ['a,b', 15], ['a,c', 14.4], ['a,c,d', 5], ['c,d', 13], ['d', 14], ['c,b', 10], ['b', 7]]
df = pd.DataFrame(data, columns = ['group', 'value'])
df_mc = mc.multi_chord_on_groups_alias(df, percent=33.)
df_mc_venn = mc.multi_chord_venn(df_mc)
mc.multi_chord_plot(df_mc, level = 3, transparency = 0.5)Example 3 (1. a.):from dataoutsider import multi_chord as mc
import pandas as pd

data = [['5', 'a'], ['5', 'b'], ['5', 'd'], ['2', 'b'], ['2', 'c'], ['3', 'b'], ['3', 'd'], ['4', 'c']]
df = pd.DataFrame(data, columns = ['inner', 'outer'])
lookup = mc.multi_chord_get_alias(df, 'outer', 'inner')
print(lookup) # use outer_ID (alias) to set manual order
df_mc = mc.multi_chord_alias(df, outer='outer', inner='inner', order='1,3,2,4', percent=33.) #, order = 'b,c,d,a'
mc.multi_chord_plot(df_mc, level = 3, transparency = 0.5)Example 4 (1. b. version of Example 3):from dataoutsider import multi_chord as mc
import pandas as pd

data = [['a,b,d', 1], ['b,c', 1], ['b,d', 1], ['c', 1]]
df = pd.DataFrame(data, columns = ['group', 'value'])
df_mc = mc.multi_chord_on_groups_alias(df, order = 'b,c,d,a', percent=33.)
mc.multi_chord_plot(df_mc, level = 3, transparency = 0.5)Functions:multi_chord_alias(df, outer, inner, percent=100., order=None, buffer = 1., elements_offset = 0.04, elements_height = 0.04, group_offset = 0., group_height = 0.04)

multi_chord_get_alias(df, outer, inner)

multi_chord_on_groups_alias(df_chord, percent=100., order=None, buffer = 1., elements_offset = 0.04, elements_height = 0.04, group_offset = 0., group_height = 0.04)

multi_chord_venn(df_mc)

multi_chord_plot(df_mc, level = None, transparency = 0.5)multi_chord_alias: Multi-Chord Diagram generator that encodes the supplied groups with an alias, output: Pandas DataFramemulti_chord_get_alias: retreive the alias for the supplied groups (can use to create a manual ordering)multi_chord_on_groups_alias: Multi-Chord Diagram generator based on pre-defined groupings, output: Pandas DataFramemulti_chord_venn: output for creating an Upset plot, output: Pandas DataFramemulti_chord_plot: generate a plot using MatplotlibParameters:ParameterValuesDescriptiondf(DataFrame)Pandas DataFrameouter(string)Column name of groupinner(string)Column name of group entitypercent(float: 0-100)Percent of full circle to draw withinorder(csv string)Group orderbuffer(float)Radial distance between groupselements_offset(float)Distance offset of element legend for entitieselements_height(float)Height of element legend for entitiesgroup_offset(float)Distance offset of group legendgroup_height(float)Height of group legenddf_mc(DataFrame)Pandas DataFrame of multi-chord resultslevel(int)Bold chords by count of groups in chord (optional)transparency(float: 0-1)Add color transparency (optional)Pie-Tree ChartNeed to display hierarchical density as pie-shaped areas?Select [1 to n] categorical columns from a dataframe to group byConfigure the chart ordering and hierarchy orientationThe pie-tree chart will create a hierarchical set of areas sized by the number of rows in each group at each levelAssumes 1 row = 1 unitExample:from dataoutsider import pie_tree as pt

df = pt.load_aircraft_df()
levels = ['Registrant', 'Aircraft', 'Engine', 'seats_bin']

inner_radius = 0.5
outer_radius = 2.0
starting_angle = 0.0
ending_angle = 360.0
point_resolution = 200
pie_tree_df = pt.pie_tree_calc(
    df, levels, 
    inner_radius, 
    outer_radius, 
    starting_angle, 
    ending_angle, 
    point_resolution)

pt.pie_tree_plot(pie_tree_df, 4)Functions:def pie_tree_calc(df, groupers, r1, r2, start_angle, end_angle, points, default_sort = False, default_sort_override = True, default_sort_override_reversed = False, all_vertical = False)

pie_tree_plot(pie_tree_df, level = 1, transparency = 0.5, line_level = 0)pie_tree_calc: Pie-Tree (Pie-Map) Chart generator, output: Pandas DataFramemulti_chord_plot: generate a plot using MatplotlibParameters:ParameterValuesDescriptiondf(DataFrame)Pandas DataFramegrouperslist of (string)Columns names in dfr1(float)Innder radiusr2(float)Outer radius (> inner radius)start_angle(float)Angle to start drawingend_angle(float)Angle to end drawingpoints(int)Resolution for curve drawingdefault_sortTrue/FalseDefault:False, True: pandas sort, False: data sortdefault_sort_overrideTrue/FalseDefault:True, True: overrides default_sortdefault_sort_override_reversedTrue/FalseDefault:False, sort areas True: desc, False: ascall_verticalTrue/FalseDefault:False, True: break levels vertically, False: alternatelevel(int)Hierarchy level to plot (optional)transparency(float: 0-1)Add color transparency (optional)line_level(int)Hierarchy level to bold (optional)Variations:Bubble Series ChartNeed to visualize sized bubbles that have a positional feature?Identify the columns names in the data for item, position, and size (circle area)Add an optional radius buffer to separate the circlesThe bubble series chart will pack all of the sized circles deterministically according to their positions (along the horizontal axis)Assumes 1 row = 1 unitExample:from dataoutsider import bubble_series as bs

data = [
    ('a',-5.2,4.1),
    ('b',-3.2,3.5),
    ('c',2,2),
    ('d',1,7),
    ('e',5,5),
    ('f',13,4),
    ('g',12,3),
    ('h',1.5,0.5)]
df = pd.DataFrame(data, columns = ['name', 'position', 'size'])

df_bs = bs.bubble_series_calc(df, 'name', 'position', 'size', 0.0)
bs.bubble_series_plot(df_bs)Functions:bubble_series_calc(df, item_col_name, position_col_name, size_col_name, r_buffer=0.0)

bubble_series_plot(bubble_series_calc_df, transparency = 0.5)bubble_series_calc: Bubble Series Chart generator, output: Pandas DataFramebubble_series_plot: generate a plot using MatplotlibParameters:ParameterValuesDescriptiondf(DataFrame)Pandas DataFrameitem_col_name(string)Columns name of itemsposition_col_name(string)Columns name of item's positionssize_col_name(string)Columns name of item's sizesr_buffer(float)radius buffer to add separation between bubbles (optional)transparency(float: 0-1)Add color transparency (optional)Tableau usersOutput:Polygon chart: Columns: [x], Rows: [y], Path: [path], Detail: varies by algorithm, use grouping fields as needed (see examples below)Examples:Multi-Chord Diagram:Sink or SwimPie-Tree Chart:TakeoffBubble Series Chart:Black Hole SunCheck back soon for updates!