src.visualise package#
Submodules#
src.visualise.asynchrony_plots module#
Classes used for plotting asynchrony and rhythmic feel
- class src.visualise.asynchrony_plots.BarPlotProportionalAsynchrony(async_df: DataFrame, **kwargs)#
Bases:
BasePlot
Create a barplot showing the proportional asynchrony between different instruments at all beat levels
- BAR_KWS = {'dodge': True, 'errorbar': None, 'estimator': <function mean>, 'hue_order': dict_keys(['piano', 'bass', 'drums']), 'width': 0.8, 'zorder': 5}#
- ERROR_KWS = {'color': '#000000', 'ls': '-', 'lw': 2, 'zorder': 15}#
- static _add_notation_vals() list #
Creates a generator of image objects (consisting of musical notation values) to be added to the plot
- _bootstrap() list #
Bootstrap the asynchrony values
- _bootstrap_errorbars() None #
Bootstrap the errorbars for the plot and add them in
- _create_plot()#
Create the main plot
- _format_ax() None #
Format axis-level parameters
- _format_fig() None #
Format figure-level parameters
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.asynchrony_plots.HistPlotProportionalAsynchrony(async_df: DataFrame, **kwargs)#
Bases:
BasePlot
Creates a histogram plot of proportional asynchrony values
- FILL_KWS = {'alpha': 0.1, 'zorder': 0}#
- PLOT_KWS = {'ls': '-', 'lw': 2, 'zorder': 5}#
- VLINE_KWS = {'alpha': 1, 'linestyle': 'dashed', 'linewidth': 3.0, 'zorder': 4}#
- _add_images() None #
Add notation images into the plot
- _create_plot() None #
Create the main plot
- static _find_peaks(x, y) array #
Find peaks from a fitted KDE and sort them
- _format_ax() None #
Format axis-level parameters
- _format_fig()#
Format figure-level parameters
- static _kde(vals: array) tuple #
Fit the KDE to the data and evaluate on a linear space of integers, then scale
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.asynchrony_plots.HistPlotProportionalAsynchronyTriosPiano(async_df: DataFrame, **kwargs)#
Bases:
BasePlot
Creates density plots for each pianist, showing asynchrony with both accompanying instruments
- FILL_KWS = {'alpha': 0.1, 'zorder': 5}#
- PLOT_KWS = {'ls': '-', 'lw': 2, 'zorder': 10}#
- VLINE_KWS = {'alpha': 1, 'linestyle': 'dashed', 'linewidth': 3.0, 'zorder': 1}#
- XTICKLABELS = ['-25.0%', '-12.5%', '-6.2%', '$\\pm$0%', '6.2%', '12.5%', '25.0%']#
- XTICKS = [-0.0625, -0.03125, -0.015625, 0, 0.015625, 0.03125, 0.0625]#
- _add_bandleader_images(bl: str, ax: Axes, y: float = 0.5) None #
Adds images corresponding with each bandleader bl to the provided axis object ax
- _add_notation_images(y: float = 5.7) None #
Adds images corresponding with notation values to the plot
- _create_plot() None #
Create the main plot
- _format_ax() None #
Format axis-level parameters
- _format_fig() None #
Format figure-level parameters
- static _kde(vals: array, bw_adjust: float = 1.2) tuple #
Fit the KDE to the data and evaluate on a linear space of integers, then scale between 0 and 1
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- img_loc = 'c:\\python projects\\jazz-corpus-analysis/references/images/musicians'#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.asynchrony_plots.PolarPlotAsynchrony(async_df: DataFrame, **kwargs)#
Bases:
BasePlot
Creates the “propeller” plot of asynchrony values across different beat levels
- ARROW_KWS = {'arrowstyle': '-|>', 'color': '#000000', 'connectionstyle': 'arc3,rad=-0.39269908169872414', 'coordsA': 'figure fraction', 'coordsB': 'figure fraction', 'linestyle': '-', 'linewidth': 4, 'mutation_scale': 16}#
- CIRCLE_FILL_KWS = {'fc': '#FFFFFF', 'linewidth': 2, 'zorder': 5}#
- CIRCLE_LINE_KWS = {'color': '#000000', 'markerfacecolor': '#FFFFFF', 'markersize': 0.1, 'zorder': 10}#
- CIRCLE_PADDING = 0.5#
- CIRCLE_PADDING_RANGE = range(5, 17, 2)#
- FILL_KWS = {'alpha': 0.1, 'step': 'pre', 'zorder': 3}#
- KDE_BANDWIDTH = 0.0095#
- LINE_KWS = {'drawstyle': 'steps-pre', 'linestyle': '-', 'linewidth': 2, 'zorder': 3}#
- _add_center_circle() None #
Plot a filled circle at the center of the plot
- _create_plot() None #
Create the main plot
- _format_ax() None #
Format axis level parameters
- _format_fig() None #
Adjust figure-level parameters
- _format_ticks() None #
Format ticks on the radial axis
- _kde(data: array, len_data: int = 1000) tuple #
Fit the KDE to the data and evaluate
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.asynchrony_plots.RegPlotPianistAsynchrony(async_df: DataFrame, **kwargs)#
Bases:
BasePlot
Create a regression plot showing association between accompaniment-soloist asynchrony and tempo
- BIN_MULTIPLER = 1.5#
- FILL_KWS = {'alpha': 0.4, 'ls': '-', 'lw': 0, 'zorder': 5}#
- FORMULA = "diff ~ tempo_standard * C(instr, Treatment(reference='bass'))"#
- HIST_KWS = {'alpha': 0.4, 'color': '#000000', 'kde': False, 'ls': '-', 'lw': 2}#
- LINE_KWS = {'ls': '-', 'lw': 4, 'zorder': 5}#
- N_BOOT = 10000#
- RE_STRUCT = "0 + tempo_standard + C(instr, Treatment(reference='bass'))"#
- SCATTER_KWS = {'alpha': 0.8, 'edgecolor': '#000000', 'hue_order': ['bass', 'drums'], 'markers': ['s', 'D'], 'palette': ['#008000', '#0000FF'], 's': 40, 'zorder': 3}#
- static _add_notation_vals() list #
Adds notation values into the plot
- _create_main_plot() None #
Creates the main axis plot
- _create_marginal_plots()#
Plots histograms and density estimates onto the marginal axis
- _create_plot() None #
Creates both main and marginal axis
- _format_ax()#
Sets axis-level parameters for both main and marginal axis
- _format_bootstrap_lines(boot_models: list) list #
Formats data from a series of bootstrapped models into one dataframe of errors
- _format_fig() None #
Format figure-level properties
- _format_main_ax()#
Sets axis-level parameters for the main plot
- _format_marginal_ax()#
Formats axis-level properties for marginal axis
- _get_bootstrapped_sample() list #
Returns bootstrapped samples of the full dataset
- _get_line(md) list #
Create the line for the regression model, with interaction effects
- _mixedlm(data)#
Fit the regression model
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.asynchrony_plots.ScatterPlotAsynchronyTrack(onset_maker, **kwargs)#
Bases:
BasePlot
Creates a scatter plot for all onset values within a given track, similar to those in OnsetSync R package
- _create_plot() None #
Creates main plot: scatter plot of each instrument
- _format_ax() None #
Formats axis-level parameters
- _format_fig() None #
Formats figure-level parameters
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- format_df() list #
Formats provided onset maker into correct dataframe format for plotting
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- wraparound = 0.9#
src.visualise.bur_plots module#
Classes used for plotting beat-upbeat ratios
- class src.visualise.bur_plots.BarPlotBUR(bur_df, **kwargs)#
Bases:
BasePlot
Create a bar chart showing average beat-upbeat ratio values
- BAR_KWS = {'alpha': 0.8, 'capsize': 0.1, 'dodge': False, 'edgecolor': '#000000', 'errcolor': '#000000', 'errorbar': ('ci', 95), 'estimator': <function mean>, 'hue_order': dict_keys(['piano', 'bass', 'drums']), 'ls': '-', 'lw': 2, 'palette': ['#FF0000', '#008000', '#0000FF'], 'seed': 42, 'width': 0.8, 'zorder': 1}#
- BURS_WITH_IMAGES = [1, 2]#
- _create_plot() None #
Create the plot in seaborn
- _format_ax() None #
Set axis-level parameters
- _format_fig() None #
This function should contain the code for formatting the self.fig objects
- add_bur_images(y: float) list #
Adds images for required BUR values at given position y
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.bur_plots.HistPlotBURByInstrument(bur: DataFrame, peaks: DataFrame, **kwargs)#
Bases:
BasePlot
Creates density plots of BUR values obtained for each instrument
- BURS_WITH_IMAGES = [0.5, 1, 2, 3]#
- HIST_KWS = {'align': 'edge', 'ls': '-', 'lw': 1.0, 'zorder': 2}#
- KDE_KWS = {'alpha': 1, 'linestyle': '-', 'linewidth': 2, 'zorder': 3}#
- VLINE_KWS = {'alpha': 1, 'color': '#000000', 'linestyle': 'dashed', 'linewidth': 3.0, 'zorder': 4}#
- _add_peaks(ax: Axes, ins: str) None #
Adds peaks onto the given axis object ax, for the given instrument ins
- _create_plot() None #
Creates the histogram and kde plots
- _format_ax() None #
Formats axis-level properties
- _format_fig() None #
Formats figure-level properties
- static _kde(data, len_data: int = 1000) tuple #
Fit the KDE to the data and evaluate on a list of y-values, then scale
- add_bur_images(y: float) list #
Adds images for required BUR values
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.bur_plots.HistPlotBURTrack(onset_maker, **kwargs)#
Bases:
HistPlotBURByInstrument
- BURS_WITH_IMAGES = [0.5, 1, 2, 3]#
- HIST_KWS = {'align': 'edge', 'ls': '-', 'lw': 1.0, 'zorder': 2}#
- KDE_KWS = {'alpha': 1, 'linestyle': '-', 'linewidth': 2, 'zorder': 3}#
- VLINE_KWS = {'alpha': 1, 'color': '#000000', 'linestyle': 'dashed', 'linewidth': 3.0, 'zorder': 4}#
- _add_peaks(ax: Axes, ins: str) None #
Adds peaks onto the given axis object ax, for the given instrument ins
- _create_plot() None #
Creates the histogram and kde plots
- _format_ax()#
Formats axis-level properties
- _format_fig() None #
Formats figure-level properties
- static _kde(data, len_data: int = 1000) tuple #
Fit the KDE to the data and evaluate on a list of y-values, then scale
- add_bur_images(y: float) list #
Adds images for required BUR values
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- static format_df(om)#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.bur_plots.RegPlotBURTempo(bur_df: DataFrame, **kwargs)#
Bases:
BasePlot
Creates a graph showing tempo vs mean BUR, with marginal distributions
- BIN_MULTIPLER = 1.5#
- BURS_WITH_IMAGES = [0.5, 1, 2]#
- BUR_THRESHOLD = 15#
- FILL_KWS = {'alpha': 0.4, 'ls': '-', 'lw': 0}#
- HIST_KWS = {'alpha': 0.4, 'color': '#000000', 'kde': False, 'ls': '-', 'lw': 2}#
- LINE_KWS = {'ls': '-', 'lw': 4}#
- MODEL = "bur_mean ~ tempo_standard * C(instrument_, Treatment(reference='piano'))"#
- N_BOOT = 10000#
- RE_FORMULA = "0 + tempo_standard + C(instrument_, Treatment(reference='piano'))"#
- SCATTER_KWS = {'alpha': 0.2, 'edgecolor': '#000000', 'hue_order': dict_keys(['piano', 'bass', 'drums']), 'markers': ['o', 's', 'D'], 'palette': ['#FF0000', '#008000', '#0000FF'], 's': 20, 'zorder': 1}#
- _create_main_plot() None #
Plots regression and scatter plot onto the main axis, with bootstrapped errorbars
- _create_marginal_plots() None #
Plots histograms and density estimates onto the marginal axis
- _create_plot() None #
Creates the main and marginal plots
- _format_ax() None #
Formats axis-level properties
- _format_bootstrap_lines(big: list) list #
Formats data from a series of bootstrapped models into one dataframe of errors
- _format_df(bur_df: DataFrame) DataFrame #
Formats the dataframe of raw BUR values
- _format_fig()#
Format figure-level properties
- _format_main_ax() None #
Formats axis-level properties for the main axis
- _format_marginal_ax() None #
Formats axis-level properties for marginal axis
- _get_bootstrapped_sample() list #
Returns bootstrapped samples of the full dataset
- _get_line(model) list #
Creates data for a straight line by predicting values from a mixed effects model
- _mixedlm(model_data: DataFrame)#
Creates a mixed effects model with given parameters from a dataset
- add_bur_images(y: float)#
Adds images for required BUR values at given position y
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.bur_plots.ViolinPlotBURs(bur_df: DataFrame, **kwargs)#
Bases:
BasePlot
Plots the distribution of BUR values obtained for each musician on a specific instrument
- BURS_WITH_IMAGES = [0.5, 1, 2, 3]#
- EBAR_KWS = {'capsize': 5, 'capthick': 3.0, 'color': '#FF0000', 'ecolor': '#FF0000', 'linewidth': 3.0, 'ls': 'none', 'zorder': 10}#
- PAL = [[0.9580211818737975, 0.8501356431005291, 0.877101648116473], [0.955171839712585, 0.8415374240303407, 0.8736946272095586], [0.9512844932165598, 0.8306464329955993, 0.8697166726823993], [0.9478884723961996, 0.8218246986542052, 0.8667478638501572], [0.9432510664088574, 0.8106685207858567, 0.8632863404249106], [0.9392013111857155, 0.8016453063819227, 0.8607018249439392], [0.9336792460992013, 0.7902494473754927, 0.8576793511036892], [0.9288675055384978, 0.7810431689566265, 0.8554089900345787], [0.9223247801972811, 0.7694276349378844, 0.8527272291989232], [0.9166416838919914, 0.7600514535538325, 0.8506835112348358], [0.908940783741381, 0.7482284944597425, 0.8482215390898507], [0.9022755558662785, 0.7386883123029254, 0.8462980788342536], [0.8932767987288097, 0.7266596199400949, 0.843910192030774], [0.8855164505347134, 0.7169515555397499, 0.8419796609321726], [0.8750765440408986, 0.7047046760243042, 0.8394922859072622], [0.8661043006428414, 0.6948117758207528, 0.8374034319249332], [0.8540737278478931, 0.6823153498232009, 0.8346105866344263], [0.843766300585397, 0.6722031398767139, 0.8321837819457866], [0.8299849094750271, 0.6594003287549722, 0.8288401817311974], [0.8182079663799163, 0.6490105365535362, 0.8258605486703084]]#
- SCAT_KWS = {'edgecolor': '#000000', 'facecolor': '#FF0000', 'lw': 1.0, 's': 100, 'zorder': 15}#
- VP_KWS = {'showextrema': False, 'showmeans': False, 'vert': False}#
- _add_bandleader_images(bl: str, y: float) None #
Adds images corresponding to a given bandleader bl at position y
- _add_nburs_to_tick() None #
Add the total number of BURs gathered for each musician next to their name
- _create_plot() None #
Creates violinplot in seaborn
- _format_ax() None #
Format axis-level properties
- _format_fig() None #
Format figure-level properties
- add_bur_images(y)#
Adds images for required BUR values
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- img_loc = 'c:\\python projects\\jazz-corpus-analysis/references/images/musicians'#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
src.visualise.complexity_plots module#
Classes used for plotting inter-onset interval complexity
- class src.visualise.complexity_plots.BarPlotComplexityDensity(complex_df, **kwargs)#
Bases:
BasePlot
Createa a barplot showing levels of complexity and density for each instrument
- BAR_KWS = {'alpha': 0.8, 'capsize': 0.1, 'dodge': False, 'edgecolor': '#000000', 'errcolor': '#000000', 'errorbar': ('ci', 95), 'estimator': <function mean>, 'hue_order': dict_keys(['piano', 'bass', 'drums']), 'ls': '-', 'lw': 2, 'n_boot': 10000, 'palette': ['#FF0000', '#008000', '#0000FF'], 'seed': 42, 'width': 0.8, 'zorder': 3}#
- _create_plot() None #
Creates plots in seaborn
- _format_ax() None #
Format axis-level parameters
- _format_fig() None #
Formats figure-level parameters
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.complexity_plots.BarPlotTotalBins(ioi_df, **kwargs)#
Bases:
BasePlot
Creates a barplot showing the number of inter-onset intervals contained within each bin
- BAR_KWS = {'color': ['#FF0000', '#008000', '#0000FF'], 'edgecolor': '#000000', 'kind': 'bar', 'label': 'Bin', 'lw': 2, 'stacked': True, 'ylabel': 'Count', 'zorder': 10}#
- _add_notation_images(y: int = 155000) None #
Adds notation images to plot at given position y
- _create_plot()#
This function should contain the code for plotting the graph
- _format_ax()#
Format axis-level parameters
- _format_fig() None #
Formats figure-level parameters
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- img_loc = 'c:\\python projects\\jazz-corpus-analysis/references/images/notation'#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.complexity_plots.HistPlotBins(ioi_df: DataFrame, **kwargs)#
Bases:
BasePlot
Creates a histogram showing the density of inter-onset intervals across each bin for all instruments
- HIST_KWS = {'align': 'edge', 'ls': '-', 'lw': 1.0, 'zorder': 2}#
- LINE_KWS = {'alpha': 1, 'color': '#000000', 'linestyle': '-', 'linewidth': 2, 'zorder': 3}#
- PALETTE = ['#000000', (0.4980392156862745, 0.4980392156862745, 0.4980392156862745), (0.8901960784313725, 0.4666666666666667, 0.7607843137254902), (0.5490196078431373, 0.33725490196078434, 0.29411764705882354), (0.5803921568627451, 0.403921568627451, 0.7411764705882353), (0.8392156862745098, 0.15294117647058825, 0.1568627450980392), (0.17254901960784313, 0.6274509803921569, 0.17254901960784313), (1.0, 0.4980392156862745, 0.054901960784313725), (0.12156862745098039, 0.4666666666666667, 0.7058823529411765), '#000000']#
- VLINE_KWS = {'alpha': 0.4, 'color': '#000000', 'linewidth': 1.3333333333333333, 'zorder': 4}#
- _create_plot() None #
Create the main plot
- _format_ax() None #
Format axis-level parameters
- _format_fig() None #
Format figure-level parameters
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.complexity_plots.HistPlotBinsTrack(onset_maker, **kwargs)#
Bases:
HistPlotBins
- HIST_KWS = {'align': 'edge', 'ls': '-', 'lw': 1.0, 'zorder': 2}#
- LINE_KWS = {'alpha': 1, 'color': '#000000', 'linestyle': '-', 'linewidth': 2, 'zorder': 3}#
- PALETTE = ['#000000', (0.4980392156862745, 0.4980392156862745, 0.4980392156862745), (0.8901960784313725, 0.4666666666666667, 0.7607843137254902), (0.5490196078431373, 0.33725490196078434, 0.29411764705882354), (0.5803921568627451, 0.403921568627451, 0.7411764705882353), (0.8392156862745098, 0.15294117647058825, 0.1568627450980392), (0.17254901960784313, 0.6274509803921569, 0.17254901960784313), (1.0, 0.4980392156862745, 0.054901960784313725), (0.12156862745098039, 0.4666666666666667, 0.7058823529411765), '#000000']#
- VLINE_KWS = {'alpha': 0.4, 'color': '#000000', 'linewidth': 1.3333333333333333, 'zorder': 4}#
- _create_plot() None #
Create the main plot
- _format_ax() None #
Format axis-level parameters
- _format_df(om)#
- _format_fig() None #
Formats figure-level properties
- static _kde(data, len_data: int = 1000) tuple #
Fit the KDE to the data and evaluate on a list of y-values, then scale
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.complexity_plots.RegPlotTempoDensityComplexity(average_df, **kwargs)#
Bases:
BasePlot
Creates a regression plot showing associations between tempo, density, and complexity scores
- HIST_KWS = {'alpha': 0.4, 'color': '#000000', 'kde': False, 'ls': '-', 'lw': 2}#
- LINE_KWS = {'color': '#000000', 'ls': '-', 'lw': 4, 'zorder': 5}#
- REG_KWS = {'ci': 95, 'n_boot': 10000, 'scatter': False}#
- SCATTER_KWS = {'alpha': 0.4, 'edgecolor': '#000000', 'hue_order': dict_keys(['piano', 'bass', 'drums']), 'markers': ['o', 's', 'D'], 'palette': ['#FF0000', '#008000', '#0000FF'], 's': 40, 'style_order': dict_keys(['piano', 'bass', 'drums']), 'zorder': 3}#
- TEXT_BBOX = {'boxstyle': 'round,pad=1', 'edgecolor': '#000000', 'facecolor': '#FFFFFF', 'ls': '-', 'lw': 2}#
- _add_regression_coeff(var_: str, ax: Axes, xpos: float) None #
Adds regression plot between tempo and given variable var_ onto axis object ax at position xpos
- _create_main_plot() None #
Creates main plotting object (scatter and regression plots)
- _create_marginal_plot() None #
Creates marginal plotting objects (density plots)
- _create_plot() None #
Creates both main and marginal plot
- _format_ax() None #
Format axis-level parameters for both main and marginal ax
- _format_fig() None #
Format figure level parameters
- _format_main_ax() None #
Formats axis-level parameters for main plot
- _format_marginal_ax() None #
Formats axis-level parameters for marginal ax
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.complexity_plots.ViolinPlotOnsetComplexity(complex_df: DataFrame, **kwargs)#
Bases:
BasePlot
- EBAR_KWS = {'capsize': 5, 'capthick': 3.0, 'color': '#FF0000', 'ecolor': '#FF0000', 'linewidth': 3.0, 'ls': 'none', 'zorder': 10}#
- KDE_KWS = {'bw_method': 'scott', 'cut': 0, 'density_norm': 'count', 'gridsize': 10000, 'hue': True, 'hue_order': [True, False], 'inner': None, 'legend': False, 'linecolor': '#000000', 'palette': [[0.9580211818737975, 0.8501356431005291, 0.877101648116473], [0.955171839712585, 0.8415374240303407, 0.8736946272095586], [0.9512844932165598, 0.8306464329955993, 0.8697166726823993], [0.9478884723961996, 0.8218246986542052, 0.8667478638501572], [0.9432510664088574, 0.8106685207858567, 0.8632863404249106], [0.9392013111857155, 0.8016453063819227, 0.8607018249439392], [0.9336792460992013, 0.7902494473754927, 0.8576793511036892], [0.9288675055384978, 0.7810431689566265, 0.8554089900345787], [0.9223247801972811, 0.7694276349378844, 0.8527272291989232], [0.9166416838919914, 0.7600514535538325, 0.8506835112348358], [0.908940783741381, 0.7482284944597425, 0.8482215390898507], [0.9022755558662785, 0.7386883123029254, 0.8462980788342536], [0.8932767987288097, 0.7266596199400949, 0.843910192030774], [0.8855164505347134, 0.7169515555397499, 0.8419796609321726], [0.8750765440408986, 0.7047046760243042, 0.8394922859072622], [0.8661043006428414, 0.6948117758207528, 0.8374034319249332], [0.8540737278478931, 0.6823153498232009, 0.8346105866344263], [0.843766300585397, 0.6722031398767139, 0.8321837819457866], [0.8299849094750271, 0.6594003287549722, 0.8288401817311974], [0.8182079663799163, 0.6490105365535362, 0.8258605486703084]], 'split': True}#
- PAL = [[0.9580211818737975, 0.8501356431005291, 0.877101648116473], [0.955171839712585, 0.8415374240303407, 0.8736946272095586], [0.9512844932165598, 0.8306464329955993, 0.8697166726823993], [0.9478884723961996, 0.8218246986542052, 0.8667478638501572], [0.9432510664088574, 0.8106685207858567, 0.8632863404249106], [0.9392013111857155, 0.8016453063819227, 0.8607018249439392], [0.9336792460992013, 0.7902494473754927, 0.8576793511036892], [0.9288675055384978, 0.7810431689566265, 0.8554089900345787], [0.9223247801972811, 0.7694276349378844, 0.8527272291989232], [0.9166416838919914, 0.7600514535538325, 0.8506835112348358], [0.908940783741381, 0.7482284944597425, 0.8482215390898507], [0.9022755558662785, 0.7386883123029254, 0.8462980788342536], [0.8932767987288097, 0.7266596199400949, 0.843910192030774], [0.8855164505347134, 0.7169515555397499, 0.8419796609321726], [0.8750765440408986, 0.7047046760243042, 0.8394922859072622], [0.8661043006428414, 0.6948117758207528, 0.8374034319249332], [0.8540737278478931, 0.6823153498232009, 0.8346105866344263], [0.843766300585397, 0.6722031398767139, 0.8321837819457866], [0.8299849094750271, 0.6594003287549722, 0.8288401817311974], [0.8182079663799163, 0.6490105365535362, 0.8258605486703084]]#
- SCAT_KWS = {'edgecolor': '#000000', 'facecolor': '#FF0000', 'lw': 1.0, 's': 100, 'zorder': 15}#
- _add_bandleader_images(ax, bl: str, y: float) None #
Adds images corresponding to a given bandleader bl at position y
- _create_plot()#
This function should contain the code for plotting the graph
- _format_ax()#
Format axis-level properties
- static _format_df(df)#
- _format_fig() None #
Format figure-level properties
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- img_loc = 'c:\\python projects\\jazz-corpus-analysis/references/images/musicians'#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
src.visualise.coordination_plots module#
Classes used for plotting ensemble coordination, e.g. phase correction, simulations
- class src.visualise.coordination_plots.BarPlotCouplingCoefficients(model_df, **kwargs)#
Bases:
BasePlot
Creates bar plot of all coupling coefficients
- BAR_KWS = {'alpha': 1, 'dodge': True, 'ec': '#000000', 'errorbar': None, 'estimator': <function mean>, 'hue_order': dict_keys(['piano', 'bass', 'drums']), 'ls': '-', 'lw': 2, 'width': 0.8, 'zorder': 3}#
- _create_plot() None #
Creates main plot: bar and scatter plot
- _format_ax() None #
Set axis-level parameters
- _format_fig() None #
Sets figure-level parameters
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.coordination_plots.BarPlotModelComparison(model_df, **kwargs)#
Bases:
BasePlot
- BAR_KWS = {'capsize': 0.1, 'edgecolor': '#000000', 'errcolor': '#000000', 'errorbar': ('ci', 95), 'errwidth': 2, 'estimator': <function nanmean>, 'hue_order': dict_keys(['piano', 'bass', 'drums']), 'lw': 2, 'n_boot': 10, 'palette': ['#FF0000', '#008000', '#0000FF'], 'seed': 1, 'width': 0.8}#
- _create_plot()#
This function should contain the code for plotting the graph
- _format_ax()#
This function should contain the code for formatting the self.ax objects
- _format_fig()#
This function should contain the code for formatting the self.fig objects
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.coordination_plots.BarPlotSimulationComparison(all_sims, all_params: list, **kwargs)#
Bases:
BasePlot
Creates barplot comparing between different simulation parameters
- BAR_KWS = {'alpha': 1, 'capsize': 0.1, 'dodge': False, 'edgecolor': '#000000', 'errcolor': '#000000', 'errorbar': ('ci', 95), 'estimator': <function mean>, 'ls': '-', 'lw': 2, 'seed': 42, 'width': 0.8, 'zorder': 3}#
- HATCHES = ['', '/', '\\', '|', '', '']#
- PAL = ['#6fcbdc', '#FF0000', '#008000', '#0000FF', '#6fcbdc', '#6fcbdc']#
- TRIANGLE_KWS = {'add_text': False, 'arrow_mod': 7.5, 'head_width': 7.5, 'len_mod': 0.8, 'starting_zoom': 0.3}#
- _create_plot() None #
Creates main plot: a combination of bar plot and custom TriangleAxis
- _format_ax() None #
Sets axis-level parameters for all axis objects
- static _format_df(all_sims: list) DataFrame #
Coerces provided list of Simulation objects all_sims into a dataframe of RMS asynchrony values
- _format_fig() None #
Sets figure-level parameters
- static _format_params(param_dict: dict) DataFrame #
Format the parameters for a given TriangleAxis plot
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.coordination_plots.HistPlotCouplingTerms(coupling_df, **kwargs)#
Bases:
BasePlot
Creates histogram plot showing differences in coupling coefficients extracted from models
- HIST_KWS = {'align': 'edge', 'ls': '-', 'lw': 1.0, 'zorder': 2}#
- KDE_KWS = {'alpha': 1, 'linestyle': '-', 'linewidth': 2, 'zorder': 3}#
- TITLES = ['Self coupling ($\\alpha_{i,i}$)', 'Partner coupling ($\\alpha_{i,j}$)', 'Intercept ($\\alpha_{i,0}$)']#
- _create_plot() None #
Creates main plotting object
- _format_ax() None #
Format axis-level parameters
- _format_fig() None #
Formats figure-level parameters
- static _hist(dat: array, n_bins: int = 30) tuple #
Creates histogram for given data, returns histogram edges, heights, and widths
- static _kde(dat, len_data: int = 1000) tuple #
Creates KDE and fits to linear space of values, then scales between 0 and 1
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.coordination_plots.RegPlotCouplingGrangerCross(model_df, **kwargs)#
Bases:
BasePlot
Create a regression plot showing associations between phase correction, Granger causality and cross-corr
- COUPLING_COLS = ['coupling_piano', 'coupling_bass', 'coupling_drums']#
- CROSS_COLS = ['cross_corr_piano_r', 'cross_corr_bass_r', 'cross_corr_drums_r']#
- GRANGER_COLS = ['granger_causality_piano_i', 'granger_causality_bass_i', 'granger_causality_drums_i']#
- HIST_KWS = {'alpha': 0.4, 'color': '#000000', 'kde': False, 'ls': '-', 'lw': 2}#
- LINE_KWS = {'color': '#000000', 'ls': '-', 'lw': 4, 'zorder': 5}#
- REG_KWS = {'ci': 95, 'n_boot': 10000, 'scatter': False}#
- SCATTER_KWS = {'alpha': 0.4, 'edgecolor': '#000000', 'hue_order': dict_keys(['piano', 'bass', 'drums']), 'markers': ['o', 's', 'D'], 'palette': ['#FF0000', '#008000', '#0000FF'], 's': 40, 'style_order': dict_keys(['piano', 'bass', 'drums']), 'zorder': 3}#
- TEXT_BBOX = {'boxstyle': 'round,pad=1', 'edgecolor': '#000000', 'facecolor': '#FFFFFF', 'ls': '-', 'lw': 2}#
- _add_regression_coeff(var: str, ax: Axes, xpos: float) None #
Adds regression coefficient between coupling and given variable var to axis ax at position xpos
- _create_main_plot() None #
Creates main plotting object: regression and scatter plot between Granger, phase correction, cross-corr
- _create_marginal_plot()#
Creates marginal plot: density of all variables
- _create_plot() None #
Creates both main and marginal plotting objects
- _format_ax() None #
Sets axis-level parameters for both main and marginal plots
- _format_df(model_df: DataFrame) DataFrame #
Coerces provided model_df dataframe into correct format
- _format_fig() None #
Sets figure-level parameters for plot
- _format_main_ax() None #
Sets axis-level parameters for main plots (scatter/regression line)
- _format_marginal_ax() None #
Sets axis-level parameters for marginal plots (histogram/density)
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.coordination_plots.RegPlotCouplingHalves(halves_df, **kwargs)#
Bases:
BasePlot
Create a regression plot showing relationship between coupling in two halves of a piece
- HIST_KWS = {'alpha': 0.4, 'color': '#000000', 'kde': False, 'ls': '-', 'lw': 2}#
- LINE_KWS = {'color': '#000000', 'ls': '-', 'lw': 4, 'zorder': 5}#
- REG_KWS = {'ci': 95, 'n_boot': 10000, 'scatter': False}#
- SCATTER_KWS = {'alpha': 0.8, 'edgecolor': '#000000', 'hue_order': dict_keys(['piano', 'bass', 'drums']), 'markers': ['o', 's', 'D'], 'palette': ['#FF0000', '#008000', '#0000FF'], 's': 40, 'style_order': dict_keys(['piano', 'bass', 'drums']), 'zorder': 3}#
- TEXT_BBOX = {'boxstyle': 'round,pad=1', 'edgecolor': '#000000', 'facecolor': '#FFFFFF', 'ls': '-', 'lw': 2}#
- _add_regression_text() None #
Adds regression text to main axis
- _create_main_plot() None #
Creates the main plot: scatter and regression plots
- _create_marginal_plot() None #
Creates the marginal plot: density plots
- _create_plot() None #
Creates both main and marginal plots
- _format_ax() None #
Formats axis-level paramters for both main and marginal plot
- _format_fig() None #
Formats figure-level parameters
- _format_main_ax() None #
Formats axis-level paramters on main plot
- _format_marginal_ax() None #
Formats axis-level paramters on marginal plot
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.coordination_plots.TriangleAxis(grp: DataFrame, ax: Axes, **kwargs)#
Bases:
object
This class plots a single axes, showing the measured couplings between each musician in a trio.
The direction of arrows indicates the influence and influencer instruments, namely the tendency of one performer to follow (and adapt to) the indicated instrument: the thickness and colour of the arrows indicate the strength of this coupling. This graph is similar to Figure 3b. in Jacoby, Polak, & London (2021).
- Args:
grp (pd.DataFrame): the dataframe to plot, should contain information from one ensemble only. ax (plt.Axes): the axes object to plot onto.
- References:
Jacoby, N., Polak, R., & London, J. (2021). Extreme precision in rhythmic interaction is enabled by role-optimized sensorimotor coupling: Analysis and modelling of West African drum ensemble music. Philosophical Transactions of the Royal Society B: Biological Sciences, 376(1835), 20200331.
- _add_center_text()#
Adds in text to the center of the plot
- _add_coupling_coefficient_text(constant, x, x2, y, y2, mod: float = 0.03, rotation: float = 0) None #
Adds coupling coefficient text into the plot
- _add_musicians_images() None #
Adds images corresponding to each performer in the trio
- _create_plot() None #
Creates the plot arrows and annotations, according to the modelled coupling responses.
- _get_coupling_coefficient(influenced: str, influencer: str) tuple[float, float, float] #
Helper function to get the coupling coefficient between two instruments, the influencer and influenced.
- create_plot() Axes #
Called from outside the class to generate the required plot elements, show them, and save
- img_loc = 'c:\\python projects\\jazz-corpus-analysis/references/images/musicians'#
- class src.visualise.coordination_plots.TrianglePlotChronology(df: DataFrame, **kwargs)#
Bases:
BasePlot
Creates a triangle plot for each trio combination in the chronology corpus
- _create_plot()#
Create a _TriangleAxis object for each trio
- _format_ax() None #
This function should contain the code for formatting the self.ax objects
- _format_fig()#
Format figure-level parameters
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.coordination_plots.TrianglePlotTrack(onset_maker)#
Bases:
BasePlot
- BAR_KWS = {'alpha': 1, 'dodge': True, 'ec': '#000000', 'errorbar': None, 'estimator': <function mean>, 'hue_order': dict_keys(['piano', 'bass', 'drums']), 'ls': '-', 'lw': 2, 'width': 0.8, 'zorder': 3}#
- _create_plot()#
This function should contain the code for plotting the graph
- _format_ax() None #
Set axis-level parameters
- _format_bar_df()#
- static _format_df(om)#
- _format_fig() None #
Sets figure-level parameters
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
src.visualise.corpus_plots module#
Plotting classes for corpus description, e.g. F-measures, API scraping results etc.
- class src.visualise.corpus_plots.BarPlotBandleaderDuration(cleaned_df: DataFrame, **kwargs)#
Bases:
BasePlot
Creates barplot showing duration of recordings by bandleaders included in the corpus
- BAR_KWS = {'dodge': False, 'edgecolor': '#000000', 'estimator': <function sum>, 'ls': '-', 'lw': 2, 'orient': 'h', 'zorder': 5}#
- _create_plot() None #
Creates main plot: bar chart of bandleader recording length
- _format_ax() None #
Sets axis-level parameters
- static _format_df(cleaned_df: DataFrame) DataFrame #
Coerces dataframe into correct format for plotting
- _format_fig() None #
Sets figure-level parameters
- abbreviate(s) str #
Abbreviates a name to surname, first initial
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- static initials(a) str #
Converts a list of strings of arbitrary length to their first initial
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.corpus_plots.BarPlotCorpusDuration(corp_df: str, **kwargs)#
Bases:
BasePlot
Creates bar plot showing duration of recordings by each bandleader
- BAR_KWS = {'color': ['#FF0000', '#008000'], 'edgecolor': '#000000', 'lw': 2, 'stacked': True, 'zorder': 10}#
- PERC_KWS = {'color': '#FFFFFF', 'fontsize': 18, 'ha': 'center', 'va': 'center', 'zorder': 10}#
- _add_bandleader_images(bl: str, y: float) None #
Adds image for a given pianist bl at position y
- _add_percentage() None #
Adds percentage of recording duration for each pianist included in corpus
- _create_plot() Axes #
Creates main plot object
- _format_ax() None #
Set axis-level parameters
- static _format_df(corp_df_: DataFrame) DataFrame #
Coerces corpus into correct format for plotting
- _format_fig() None #
Set figure-level parameters
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- img_loc = 'c:\\python projects\\jazz-corpus-analysis/references/images/musicians'#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.corpus_plots.BarPlotFScores(**kwargs)#
Bases:
BasePlot
Creates bar plot showing F-scores for all reference tracks and instruments
- _create_plot() None #
Creates plotting objects: bar and scatter plot
- _format_ax() None #
Sets axis-level parameters
- _format_df() list #
Coerces f-scores into correct formats
- _format_fig() None #
Sets figure-level parameters
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.corpus_plots.BarPlotLastFMStreams(streams_df: DataFrame, **kwargs)#
Bases:
BasePlot
Creates plot of total LastFM streams for top-20 most-tagged bandleaders
- BAR_KWS = {'edgecolor': '#000000', 'ls': '-', 'lw': 2, 'palette': <list_reverseiterator object>, 'zorder': 5}#
- PAL = [[0.9580211818737975, 0.8501356431005291, 0.877101648116473], [0.955171839712585, 0.8415374240303407, 0.8736946272095586], [0.9512844932165598, 0.8306464329955993, 0.8697166726823993], [0.9478884723961996, 0.8218246986542052, 0.8667478638501572], [0.9432510664088574, 0.8106685207858567, 0.8632863404249106], [0.9392013111857155, 0.8016453063819227, 0.8607018249439392], [0.9336792460992013, 0.7902494473754927, 0.8576793511036892], [0.9288675055384978, 0.7810431689566265, 0.8554089900345787], [0.9223247801972811, 0.7694276349378844, 0.8527272291989232], [0.9166416838919914, 0.7600514535538325, 0.8506835112348358], [0.908940783741381, 0.7482284944597425, 0.8482215390898507], [0.9022755558662785, 0.7386883123029254, 0.8462980788342536], [0.8932767987288097, 0.7266596199400949, 0.843910192030774], [0.8855164505347134, 0.7169515555397499, 0.8419796609321726], [0.8750765440408986, 0.7047046760243042, 0.8394922859072622], [0.8661043006428414, 0.6948117758207528, 0.8374034319249332], [0.8540737278478931, 0.6823153498232009, 0.8346105866344263], [0.843766300585397, 0.6722031398767139, 0.8321837819457866], [0.8299849094750271, 0.6594003287549722, 0.8288401817311974], [0.8182079663799163, 0.6490105365535362, 0.8258605486703084]]#
- _create_plot() None #
Creates bar plot in seaborn
- _format_ax() None #
Formats axis-level parameters
- _format_fig() None #
Formats figure-level parameters
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.corpus_plots.BarPlotSoloDuration(df, **kwargs)#
Bases:
BasePlot
- BAR_KWS = {'capsize': 0.2, 'edgecolor': '#000000', 'errcolor': '#000000', 'errorbar': 'se', 'errwidth': 2.0, 'ls': '-', 'lw': 2, 'orient': 'h', 'palette': <list_reverseiterator object>, 'width': 0.8}#
- PAL = [[0.8505451051321089, 0.8895930790140263, 0.9585823141183132], [0.8426515945511759, 0.8861974098513896, 0.9554412197250419], [0.8345997305311351, 0.8828179663439395, 0.952102289498725], [0.8263929652727889, 0.87945128459797, 0.9485577010472461], [0.8180348849581531, 0.8760936543510756, 0.9447997276878337], [0.8095291981644045, 0.8727411127683428, 0.9408207424646934], [0.8008797234840693, 0.8693894377292849, 0.9366132214879784], [0.7920903763020397, 0.8660341405252227, 0.932169746527862], [0.7831651546729191, 0.862670457875734, 0.9274830067903194], [0.7741081242339616, 0.8592933431599838, 0.9225457997929389], [0.7649234020792448, 0.8558974567438472, 0.9173510312494192], [0.7556151395094866, 0.8524771552663997, 0.9118917138601474], [0.7461875035587174, 0.8490264797290512, 0.9061609648930564], [0.7366446571835681, 0.8455391422068044, 0.9001520024234696], [0.7269907379826731, 0.8420085109730776, 0.8938581400833826], [0.7139531237435062, 0.837221517309369, 0.8850117542813849], [0.7040558076609195, 0.8335620167852427, 0.8780276042948364], [0.6940607195931869, 0.829834402862628, 0.870736853546773], [0.6839715977778802, 0.8260303313423172, 0.8631331242338904], [0.67379200911445, 0.8221409961136237, 0.8552100725619283], [0.6635253136916198, 0.8181570966028383, 0.8469613687686967], [0.6531746258665307, 0.8140688005488442, 0.8383806735473704], [0.6427427713842909, 0.809865701308027, 0.8294616103381306], [0.6322322399262439, 0.8055367687324069, 0.8201977328541621], [0.6216451323519154, 0.8010702924694993, 0.8105824870822115], [0.6109831017470833, 0.7964538162895859, 0.8006091668419522], [0.6002472872007145, 0.7916740617424325, 0.7902708617938855], [0.5894382389960169, 0.7867168390632532, 0.7795603965412788], [0.5785558336014756, 0.7815669427630931, 0.7684702591628727]]#
- _create_plot()#
This function should contain the code for plotting the graph
- _format_ax()#
This function should contain the code for formatting the self.ax objects
- _format_fig()#
This function should contain the code for formatting the self.fig objects
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- static format_func(x, _)#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.corpus_plots.BarPlotSubjectiveRatings(**kwargs)#
Bases:
BasePlot
Creates bar plot showing subjective ratings for all reference tracks and instruments
- BAR_KWS = {'capsize': 0.1, 'edgecolor': '#000000', 'errcolor': '#000000', 'errorbar': ('ci', 95), 'errwidth': 2, 'estimator': <function mean>, 'ls': '-', 'lw': 2, 'n_boot': 10000, 'seed': 1, 'width': 0.8, 'zorder': 1}#
- COLS = ['#FFFFFF', '#FF0000', '#008000', '#0000FF', '#FFFFFF', '#FF0000', '#008000', '#0000FF']#
- HATCHES = ['', '', '', '', '/', '/', '/', '/']#
- _create_plot() Axes #
Creates barplot of subjective track ratings
- _format_ax()#
Sets axis-level parameters
- _format_df() DataFrame #
Formats data into correct format and returns a dataframe
- _format_fig()#
Sets figure-level parameters
- static _get_color(hex_code: str) list #
Returns colors for given str hex_code
- static _get_legend_handles() list #
Gets handles for legend object
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.corpus_plots.BoxPlotRecordingLength(cleaned_df: DataFrame, **kwargs)#
Bases:
BasePlot
Creates box plot showing distribution of recording durations for each bandleader
- PAL = [[0.8505451051321089, 0.8895930790140263, 0.9585823141183132], [0.8263929652727889, 0.87945128459797, 0.9485577010472461], [0.7979652866047527, 0.8682716372841885, 0.9351586435271116], [0.7710605336801948, 0.8581637390918089, 0.9208431754633932], [0.7398381509604095, 0.8467060637182515, 0.9021863171613215], [0.7106651187449592, 0.8360087550056591, 0.8827173754189069], [0.6771950451280178, 0.8234474784836774, 0.8578869608205588], [0.6462289135757475, 0.8112801577549528, 0.8324726239436684], [0.6109831017470833, 0.7964538162895859, 0.8006091668419522], [0.5785558336014756, 0.7815669427630931, 0.7684702591628727]]#
- TICKS = array([ 0., 300., 600., 900., 1200., 1500., 1800., 2100.])#
- _add_bandleader_images(bl: str, y: int) None #
Adds images of pianist bl at given position y to main axis
- _add_number_of_tracks(bl: str, y: int) None #
Adds text showing the number of tracks recorded by a bandleader bl, at position y
- _create_plot() None #
Creates main plot: box and scatter plot of recording durations per bandleader
- _format_ax() None #
Sets axis-level parameters
- _format_bandleader(bl: str) str #
Formats the name of a given bandleader bl for use in axis ticks
- _format_fig() None #
Sets figure-level parameters
- static _format_time(nos: int, fmt: str = '%M:%S') str #
Formats the number of seconds nos into a string representation, in format fmt
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- img_loc = 'c:\\python projects\\jazz-corpus-analysis/references/images/musicians'#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.corpus_plots.CountPlotPanning(track_df: DataFrame, **kwargs)#
Bases:
BasePlot
Creates plot showing number of tracks with left-right stereo panning
- LEGEND_KWS = {'edgecolor': '#000000', 'framealpha': 1, 'frameon': True}#
- _add_track_numbers() None #
Adds numbers to top of each bar
- _create_plot() Axes #
Creates plot: stacked bar chart of panning directions
- _format_ax() None #
Sets axis-level parameters
- _format_fig() None #
Sets figure-level parameters
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.corpus_plots.HistPlotRecordingYear(df, **kwargs)#
Bases:
BasePlot
- BAR_KWS = {'binrange': [1945, 2015], 'bins': 8, 'edgecolor': '#000000', 'ls': '-', 'lw': 2, 'multiple': 'dodge', 'palette': ['#FFFF00', '#0000FF'], 'stat': 'count', 'zorder': 5}#
- _create_plot()#
This function should contain the code for plotting the graph
- _format_ax()#
This function should contain the code for formatting the self.ax objects
- static _format_df(df)#
- _format_fig()#
This function should contain the code for formatting the self.fig objects
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.corpus_plots.LinePlotOptimizationIterations(opt_fpath: str, **kwargs)#
Bases:
BasePlot
Creates a line plot showing the results of the optimization procedure at all iterations of the algorithm
- LINE_KWS = {'alpha': 0.4, 'errorbar': None, 'hue_order': ['mix', 'piano', 'bass', 'drums'], 'ls': '-', 'lw': 4, 'palette': ['#000000', '#FF0000', '#008000', '#0000FF'], 'zorder': 5}#
- ORDER = ['mix', 'piano', 'bass', 'drums']#
- SCATTER_KWS = {'edgecolor': '#000000', 'hue_order': ['mix', 'piano', 'bass', 'drums'], 'legend': False, 'linewidth': 2, 'markers': ['$M$', '$P$', '$B$', '$D$'], 'palette': ['#000000', '#FF0000', '#008000', '#0000FF'], 's': 200, 'style_order': ['mix', 'piano', 'bass', 'drums']}#
- _create_plot() None #
Creates main plot: line plot, with marker at final iteration
- _format_ax() None #
Sets axis-level parameters
- static _format_df(opt_fpath: str) list #
Opens up optimization results and coerces into a single dataframe for plotting
- _format_fig() None #
Sets figure-level parameters
- static _format_legend(ax: Axes, loc: str) None #
Formats legend for a given axis object ax, placed at location loc
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.corpus_plots.SpecPlotBands(track: str, **kwargs)#
Bases:
BasePlot
Plots a spectrogram for a given track
- TRACK_LEN = 5#
- _add_bands() None #
Adds bands showing the span of frequencies considered for each instrument
- _create_plot() Axes #
Creates the spectrogram in Librosa
- _format_ax() None #
Sets axis-level parameters
- _format_df() array #
Returns an array containing the spectrogram output
- _format_fig() None #
Sets figure-level parameters
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.corpus_plots.TimelinePlotBandleaders(bandleaders_df: DataFrame, **kwargs)#
Bases:
BasePlot
Creates plots showing timeline for included bandleaders and recording dates
- BAR_KWS = {'edgecolor': '#000000', 'label': None, 'zorder': 0}#
- PAL = <list_reverseiterator object>#
- SCATTER_KWS = {'alpha': 1, 'color': '#000000', 'label': 'Recording', 'marker': 'x', 's': 50, 'zorder': 1}#
- TEXT_KWS = {'fontsize': 15.0, 'ha': 'left', 'va': 'center', 'zorder': 2}#
- _add_pianist_image(bandleader_name: str, x: float, y: float) None #
Adds image of given pianist bandleader_name to positions x and y
- _create_plot() None #
Creates main plot: scatter and (broken) bar chart
- _format_ax() None #
Formats axis-level parameters
- _format_corpus_df(bandleaders_df: DataFrame) DataFrame #
Coerces data into correct format for plotting recording dates
- _format_fig() None #
Formats figure-level parameters
- static _format_timeline_df(bandleaders_df: DataFrame) DataFrame #
Coerces data into correct format for plotting timeline
- static _get_birth_death_range(birth: int, death: int, alive: bool) str #
Coerces birth and death years into string format
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- img_loc = 'c:\\python projects\\jazz-corpus-analysis/references/images/musicians'#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
src.visualise.interactive_plots module#
Classes used for creating interactive plots in plotly
- class src.visualise.interactive_plots.BarPlotCoordinationInteractive(onset_maker)#
Bases:
BasePlotPlotly
- _create_plot()#
- static _format_df(om)#
- _format_fig()#
- create_plot()#
- render_html(fpath, div_id)#
- class src.visualise.interactive_plots.HistPlotComplexityInteractive(onset_maker)#
Bases:
BasePlotPlotly
- PALETTE = ['#000000', (0.4980392156862745, 0.4980392156862745, 0.4980392156862745), (0.8901960784313725, 0.4666666666666667, 0.7607843137254902), (0.5490196078431373, 0.33725490196078434, 0.29411764705882354), (0.5803921568627451, 0.403921568627451, 0.7411764705882353), (0.8392156862745098, 0.15294117647058825, 0.1568627450980392), (0.17254901960784313, 0.6274509803921569, 0.17254901960784313), (1.0, 0.4980392156862745, 0.054901960784313725), (0.12156862745098039, 0.4666666666666667, 0.7058823529411765), '#000000']#
- _create_plot() None #
Create the main plot
- static _format_df(om)#
- _format_fig()#
- static _kde(data, len_data: int = 1000) tuple #
Fit the KDE to the data and evaluate on a list of y-values, then scale
- create_plot()#
- render_html(fpath, div_id)#
- class src.visualise.interactive_plots.HistPlotSwingInteractive(onset_maker)#
Bases:
BasePlotPlotly
- _create_plot()#
- _format_fig()#
- static _kde(data, len_data: int = 1000) tuple #
Fit the KDE to the data and evaluate on a list of y-values, then scale
- create_plot()#
- static format_df(om)#
- render_html(fpath, div_id)#
- class src.visualise.interactive_plots.ScatterPlotFeelInteractive(onset_maker)#
Bases:
BasePlotPlotly
Creates a scatter plot for all onset values within a given track, similar to those in OnsetSync R package
- _create_plot() None #
- _format_fig()#
- create_plot()#
- format_df() list #
Formats provided onset maker into correct dataframe format for plotting
- render_html(fpath, div_id)#
- wraparound = 0.9#
src.visualise.random_forest_plots module#
Plotting classes for random forest model, e.g. heatmaps, feature importance.
- class src.visualise.random_forest_plots.BarPlotCategoryImportances(importances: DataFrame, **kwargs)#
Bases:
BasePlot
Creates barplot showing average importance of feature category
- BAR_KWS = {'capsize': 0.1, 'dodge': False, 'edgecolor': '#000000', 'errorbar': None, 'estimator': <function mean>, 'hue_order': dict_keys(['Swing', 'Complexity', 'Feel', 'Interaction', 'Tempo']), 'ls': '-', 'lw': 2, 'width': 0.8, 'zorder': 3}#
- ERROR_KWS = {'capsize': 5, 'color': '#000000', 'elinewidth': 2, 'ls': 'none', 'markeredgewidth': 2, 'zorder': 5}#
- _create_plot() Axes #
Creates all plots in seaborn with given arguments
- _format_ax() None #
Formats axis-level properties
- _format_fig() None #
Formats figure-level attributes
- _format_ticks() None #
Sets tick values to the color assigned to each predictor category
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- hatches = {'Complexity': '\\', 'Feel': '|', 'Interaction': '-', 'Swing': '/', 'Tempo': '+'}#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.random_forest_plots.BarPlotFeatureImportances(importances: DataFrame, **kwargs)#
Bases:
BasePlot
Creates barplot showing importance of all features
- BAR_KWS = {'capsize': 0.1, 'dodge': False, 'edgecolor': '#000000', 'errorbar': None, 'estimator': <function mean>, 'hue_order': dict_keys(['Swing', 'Complexity', 'Feel', 'Interaction', 'Tempo']), 'ls': '-', 'lw': 2, 'width': 0.8, 'zorder': 3}#
- ERROR_KWS = {'capsize': 5, 'color': '#000000', 'elinewidth': 2, 'ls': 'none', 'markeredgewidth': 2, 'zorder': 5}#
- _create_plot() Axes #
Creates all plots in seaborn with given arguments
- _format_ax() None #
Formats axis-level properties
- _format_fig() None #
Formats figure-level attributes
- _format_ticks() None #
Sets colors for predictor ticks to their category
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- hatches = {'Complexity': '\\', 'Feel': '|', 'Interaction': '-', 'Swing': '/', 'Tempo': '+'}#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.random_forest_plots.CountPlotMissingValues(predictors_df, category_mapping, **kwargs)#
Bases:
BasePlot
Creates a bar plot showing the percentage of missing values for each predictor
- BAR_KWS = {'capsize': 0.1, 'dodge': False, 'edgecolor': '#000000', 'errorbar': None, 'hue_order': dict_keys(['Swing', 'Complexity', 'Feel', 'Interaction', 'Tempo']), 'ls': '-', 'lw': 2, 'width': 0.8, 'zorder': 3}#
- _create_plot() Axes #
Creates the main axis object: percentage of missing values
- _format_ax() None #
Formats axis-level parameters
- _format_df(pred_df: DataFrame) DataFrame #
Formats the provided dataframe pred_df into the correct format for plotting
- _format_fig() None #
Formats figure-level parameters
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.random_forest_plots.HeatMapFeatureCorrelation(features: DataFrame, **kwargs)#
Bases:
BasePlot
Creates a (triangular) heatmap showing the correlation between different predictor features
- HEAT_KWS = {'annot': True, 'annot_kws': {'size': 18}, 'cbar_kws': {'label': 'Correlation ($r$)'}, 'cmap': 'vlag', 'fmt': '.2f', 'linecolor': '#FFFFFF', 'linewidths': 1.0, 'vmax': 1, 'vmin': -1}#
- LINE_KWS = {'ls': '-', 'lw': 2}#
- TEXT_KWS = {'fontsize': 27.0, 'ha': 'right', 'rotation': 0, 'va': 'top'}#
- _add_text_to_triangle() None #
Adds text to the triangle plot
- _create_plot() Axes #
Creates main plotting object
- _format_ax() None #
Formats axis-level parameters
- _format_cax() None #
Sets parameters for the color bar
- _format_corr_labels(lim: float = 0.5) None #
Hides correlation text if values of r below given absolute limit lim
- _format_fig() None #
Formats figure-level parameters
- _format_tick_labels() None #
Sets colors for predictor tick values to their given category
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.random_forest_plots.HeatMapPredictionProbDendro(prob_df, **kwargs)#
Bases:
BasePlot
Creates a heatmap of probabilities for all pianists in a dataset, with attached clustering dendrogram
- DENDRO_KWS = {'above_threshold_color': '#000000', 'color_threshold': 0, 'no_labels': False, 'truncate_mode': None}#
- MODEL_KWS = {'distance_threshold': 0, 'linkage': 'average', 'metric': 'precomputed', 'n_clusters': None}#
- PAL = [[0.9580211818737975, 0.8501356431005291, 0.877101648116473], [0.955171839712585, 0.8415374240303407, 0.8736946272095586], [0.9512844932165598, 0.8306464329955993, 0.8697166726823993], [0.9478884723961996, 0.8218246986542052, 0.8667478638501572], [0.9432510664088574, 0.8106685207858567, 0.8632863404249106], [0.9392013111857155, 0.8016453063819227, 0.8607018249439392], [0.9336792460992013, 0.7902494473754927, 0.8576793511036892], [0.9288675055384978, 0.7810431689566265, 0.8554089900345787], [0.9223247801972811, 0.7694276349378844, 0.8527272291989232], [0.9166416838919914, 0.7600514535538325, 0.8506835112348358], [0.908940783741381, 0.7482284944597425, 0.8482215390898507], [0.9022755558662785, 0.7386883123029254, 0.8462980788342536], [0.8932767987288097, 0.7266596199400949, 0.843910192030774], [0.8855164505347134, 0.7169515555397499, 0.8419796609321726], [0.8750765440408986, 0.7047046760243042, 0.8394922859072622], [0.8661043006428414, 0.6948117758207528, 0.8374034319249332], [0.8540737278478931, 0.6823153498232009, 0.8346105866344263], [0.843766300585397, 0.6722031398767139, 0.8321837819457866], [0.8299849094750271, 0.6594003287549722, 0.8288401817311974], [0.8182079663799163, 0.6490105365535362, 0.8258605486703084]]#
- _add_pianist_images() None #
Adds images corresponding to each pianist along the plot
- _create_dendrogram() None #
Creates the dendrogram and attaches to the top of the plot
- _create_plot() None #
Creates both the agglomerative clustering dendrogram and the confusion matrix heatmap
- _fit_agg() AgglomerativeClustering #
Fits the agglomerative clustering model with the given parameters
- _format_annotations() None #
Format annotations to only show those along the diagonal, i.e. ‘hits’
- _format_ax() None #
Sets axis-level parameters for the main heatmap and the colorbar
- _format_ax_ticks() None #
Sets tick labels for all axis
- _format_dax() None #
Sets axis-level parameters for the dendrogram
- _format_fig() None #
Sets figure-level parameters
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- img_loc = 'c:\\python projects\\jazz-corpus-analysis/references/images/musicians'#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.random_forest_plots.HistPlotFirstLastP(acc_scores, first_acc, last_acc, **kwargs)#
Bases:
BasePlot
Histogram plot of the probabilities resulting from the Monte Carlo permutation test
- FILL_KWS = {'alpha': 0.4, 'edgecolor': '#000000', 'ls': '-', 'lw': 2}#
- KDE_BW = 0.3#
- KDE_KWS = {'color': '#000000', 'ls': '-', 'lw': 2, 'zorder': 5}#
- TEXT_KWS = {'bbox': {'boxstyle': 'round', 'edgecolor': 'black', 'facecolor': 'wheat', 'linewidth': 2}}#
- _create_plot() None #
Creates the main plotting object
- _format_ax() None #
Sets axis-level parameters
- _format_fig() None #
Sets figure-level parameters
- _get_kde() tuple #
Creates the kernel density estimate, fits to the data, and standardizes
- _get_pval(acc: float) float #
Returns the proportion of values below the given accuracy score acc
- static _slice_kde(x, y, acc) tuple #
Slice the KDE results between the given points
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.random_forest_plots.RegPlotCareerJazzProgress(model_df, cat_mapping, **kwargs)#
Bases:
BasePlot
- N_JOBS = -1#
- REG_KWS = {'color': '#000000', 'linewidth': 4, 'ls': '-'}#
- _create_plot()#
This function should contain the code for plotting the graph
- _format_ax()#
This function should contain the code for formatting the self.ax objects
- _format_fig()#
This function should contain the code for formatting the self.fig objects
- ax = None#
- bootstrap(data_, predict_) DataFrame #
- categories = ['Feel', 'Complexity', 'Swing', 'Tempo']#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- static fit_model(data_, predict_)#
- g = None#
- get_line(model, mean)#
- markers = ['o', 'o', 'o', 'o']#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- palette = [(0.17254901960784313, 0.6274509803921569, 0.17254901960784313), (1.0, 0.4980392156862745, 0.054901960784313725), (0.12156862745098039, 0.4666666666666667, 0.7058823529411765), (0.5803921568627451, 0.403921568627451, 0.7411764705882353)]#
- predictors = ['drums_prop_async_nanmean', 'n_onsets_std', 'bur_log_mean', 'missing_beats_perc']#
- xspace = array([0. , 0.01010101, 0.02020202, 0.03030303, 0.04040404, 0.05050505, 0.06060606, 0.07070707, 0.08080808, 0.09090909, 0.1010101 , 0.11111111, 0.12121212, 0.13131313, 0.14141414, 0.15151515, 0.16161616, 0.17171717, 0.18181818, 0.19191919, 0.2020202 , 0.21212121, 0.22222222, 0.23232323, 0.24242424, 0.25252525, 0.26262626, 0.27272727, 0.28282828, 0.29292929, 0.3030303 , 0.31313131, 0.32323232, 0.33333333, 0.34343434, 0.35353535, 0.36363636, 0.37373737, 0.38383838, 0.39393939, 0.4040404 , 0.41414141, 0.42424242, 0.43434343, 0.44444444, 0.45454545, 0.46464646, 0.47474747, 0.48484848, 0.49494949, 0.50505051, 0.51515152, 0.52525253, 0.53535354, 0.54545455, 0.55555556, 0.56565657, 0.57575758, 0.58585859, 0.5959596 , 0.60606061, 0.61616162, 0.62626263, 0.63636364, 0.64646465, 0.65656566, 0.66666667, 0.67676768, 0.68686869, 0.6969697 , 0.70707071, 0.71717172, 0.72727273, 0.73737374, 0.74747475, 0.75757576, 0.76767677, 0.77777778, 0.78787879, 0.7979798 , 0.80808081, 0.81818182, 0.82828283, 0.83838384, 0.84848485, 0.85858586, 0.86868687, 0.87878788, 0.88888889, 0.8989899 , 0.90909091, 0.91919192, 0.92929293, 0.93939394, 0.94949495, 0.95959596, 0.96969697, 0.97979798, 0.98989899, 1. ])#
- class src.visualise.random_forest_plots.RegPlotPredictorsCareerProgress(model_df, cat_mapping, **kwargs)#
Bases:
BasePlot
Creates regression plots showing associations between career progress and individual predictors
- REG_KWS = {'ci': 95, 'color': '#000000', 'line_kws': {'linewidth': 4, 'ls': '-'}, 'n_boot': 10000, 'scatter': False}#
- TEXT_KWS = {'bbox': {'boxstyle': 'round', 'edgecolor': 'black', 'facecolor': 'wheat', 'linewidth': 2}}#
- _create_plot() None #
Creates the main plotting objects: scatter and regression plots for each predictor
- _format_ax() None #
Sets axis-level parameters
- _format_fig() None #
Sets figure-level parameters
- ax = None#
- categories = ['Feel', 'Tempo', 'Swing', 'Complexity', 'Interaction']#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- markers = ['o', 's', 'D', '^', 'p']#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- palette = [(0.17254901960784313, 0.6274509803921569, 0.17254901960784313), (0.5803921568627451, 0.403921568627451, 0.7411764705882353), (0.12156862745098039, 0.4666666666666667, 0.7058823529411765), (1.0, 0.4980392156862745, 0.054901960784313725), (0.8392156862745098, 0.15294117647058825, 0.1568627450980392)]#
- predictors = ['drums_prop_async_nanmean', 'tempo', 'bur_log_mean', 'n_onsets_mean', 'coupling_piano_drums']#
- class src.visualise.random_forest_plots.RocPlotLogRegression(y_true: array, y_predict: array, **kwargs)#
Bases:
BasePlot
Creates a plot showing the receiver-operator curve from true and predicted values from a logistic regression
- _create_plot() Axes #
Creates the main plotting object using the function in sklearn
- _format_ax() None #
Sets axis-level parameters
- _format_fig() None #
Sets figure-level parameters
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- class src.visualise.random_forest_plots.StripPlotLogitCoeffs(logit_md, category_mapping, **kwargs)#
Bases:
BasePlot
Creates a ‘forest plot’ showing coefficients obtained from the logistic regression model
- ERROR_KWS = {'capsize': 5, 'color': '#000000', 'elinewidth': 2, 'linestyle': 'none', 'lw': 2, 'markeredgewidth': 2}#
- LEGEND_KWS = {'edgecolor': '#000000', 'framealpha': 1, 'frameon': True}#
- STRIP_KWS = {'edgecolor': '#000000', 'hue_order': ['Feel', 'Tempo', 'Swing', 'Complexity', 'Interaction'], 'linewidth': 2, 'zorder': 5}#
- _add_pvals(row)#
Adds in p-values for a given y-axis value row
- _create_plot() None #
Creates the forest plot
- _format_ax() None #
Sets axis-level properties
- _format_df(logit_md) DataFrame #
Coerces logistic regression output into correct format for plotting
- _format_fig() None #
Formats figure-level parameters
- _format_legend() None #
Formats axis legend
- static _format_p(pval: float) str #
Returns correct number of asterisks for a given significance level corresponding to input pval
- _format_yticks() None #
Formats y-axis ticks by setting them to their correct color for a given category
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- palette = [(0.17254901960784313, 0.6274509803921569, 0.17254901960784313), (0.5803921568627451, 0.403921568627451, 0.7411764705882353), (0.12156862745098039, 0.4666666666666667, 0.7058823529411765), (1.0, 0.4980392156862745, 0.054901960784313725), (0.8392156862745098, 0.15294117647058825, 0.1568627450980392)]#
src.visualise.visualise_utils module#
Utility classes, functions, and variables used specifically in the visualisation process
- class src.visualise.visualise_utils.BasePlot(**kwargs)#
Bases:
object
Base plotting class from which all others inherit
- _create_plot() None #
This function should contain the code for plotting the graph
- _format_ax() None #
This function should contain the code for formatting the self.ax objects
- _format_fig() None #
This function should contain the code for formatting the self.fig objects
- ax = None#
- create_plot() tuple #
Calls plot creation, axis formatting, and figure formatting classes, then saves in the decorator
- df = None#
- fig = None#
- g = None#
- output_dir = 'c:\\python projects\\jazz-corpus-analysis/reports/figures'#
- src.visualise.visualise_utils.create_output_folder(out: str) str #
Create a folder to store the plots, with optional subdirectory. Out should be a full system path
- src.visualise.visualise_utils.plot_decorator(plotter: callable) callable #
Decorator applied to any plotting function: creates a folder, saves plot, closes the folder cleanly, and exits