wub.vis package

Submodules

wub.vis.report module

class wub.vis.report.Report(pdf)[source]

Class for plotting utilities on the top of matplotlib. Plots are saved in the specified file through the PDF backend.

Parameters:
  • self – object.
  • pdf – Output pdf.
Returns:

The report object.

Return type:

Report

close()[source]

Close PDF backend. Do not forget to call this at the end of your script or your output will be damaged!

Parameters:self – object
Returns:None
Return type:object
plot_arrays(data_map, title='', xlab='', ylab='', marker='.', legend_loc='best', legend=True, vlines=None, vlcolor='green', vlwitdh=0.5)[source]

Plot multiple pairs of data arrays.

Parameters:
  • self – object.
  • data_map – A dictionary with labels as keys and tupples of data arrays (x,y) as values.
  • title – Figure title.
  • xlab – X axis label.
  • ylab – Y axis label.
  • marker – Marker passed to the plot function.
  • legend_loc – Location of legend.
  • legend – Plot legend if True
  • vlines – Dictionary with labels and positions of vertical lines to draw.
  • vlcolor – Color of vertical lines drawn.
  • vlwidth – Width of vertical lines drawn.
Returns:

None

Return type:

object

plot_bars_simple(data_map, title='', xlab='', ylab='', alpha=0.6, xticks_rotation=0, auto_limit=False)[source]

Plot simple bar chart from input dictionary.

Parameters:
  • self – object.
  • data_map – A dictionary with labels as keys and data as values.
  • title – Figure title.
  • xlab – X axis label.
  • ylab – Y axis label.
  • alpha – Alpha value.
  • xticks_rotation – Rotation value for x tick labels.
  • auto_limit – Set y axis limits automatically.
Returns:

None

Return type:

object

plot_boxplots(data_map, title='', xlab='', ylab='', xticks_rotation=0, xticks_fontsize=5)[source]

Plot multiple pairs of data arrays.

Parameters:
  • self – object.
  • data_map – A dictionary with labels as keys and lists as data values.
  • title – Figure title.
  • xlab – X axis label.
  • ylab – Y axis label.
  • xticks_rotation – Rotation value for x tick labels.
  • xticks_fontsize – Fontsize for x tick labels.
Returns:

None

Return type:

object

plot_dicts(data_map, title='', xlab='', ylab='', marker='-', legend_loc='best', legend=True, hist_style=False, cmap=<matplotlib.colors.LinearSegmentedColormap object>, alpha=0.6)[source]

Plot elements of multiple dictionaries on a single plot.

Parameters:
  • self – object.
  • data_map – A dictionary with labels as keys and dictionaries as values.
  • title – Figure title.
  • xlab – X axis label.
  • ylab – Y axis label.
  • marker – Marker passed to the plot function.
  • legend_loc – Location of legend.
  • legend – Hide legend if False.
  • hist_style – Plot histogram-style bar plots.
  • cmap – Colormap for histogram plots.
  • alpha – Transparency value for histograms.
Returns:

None

Return type:

object

plot_heatmap(data_matrix, title='', xlab='', ylab='', colormap=<matplotlib.colors.LinearSegmentedColormap object>)[source]

Plot heatmap of data matrix.

Parameters:
  • self – object.
  • data_matrix – 2D array to be plotted.
  • title – Figure title.
  • xlab – X axis label.
  • ylab – Y axis label.
  • colormap – matplotlib color map.
Retuns:

None

Return type:

object

plot_histograms(data_map, title='', xlab='', ylab='', bins=50, alpha=0.7, legend_loc='best', legend=True, vlines=None)[source]

Plot histograms of multiple data arrays.

Parameters:
  • self – object.
  • data_map – A dictionary with labels as keys and data arrays as values.
  • title – Figure title.
  • xlab – X axis label.
  • ylab – Y axis label.
  • bins – Number of bins.
  • alpha – Transparency value for histograms.
  • legend_loc – Location of legend.
  • legend – Plot legend if True.
  • vlines – Dictionary with labels and positions of vertical lines to draw.
Returns:

None

Return type:

object

plot_line(data, x, y, title='', xlab='', ylab='')[source]

Generate a line plot from pandas dataframe

Parameters:
  • data – pandas dataframe
  • x – X axis data
  • y – Y axis data
  • title – Figure title
  • xlab – X axis label
  • ylab – Y axis label
Returns:

None

Return type:

object

plot_pcolor(data, title='', xlab='', ylab='', xticks=None, yticks=None, invert_yaxis=False, colormap=<matplotlib.colors.LinearSegmentedColormap object>, tick_size=5, tick_rotation=90)[source]

Plot square heatmap of data matrix.

Parameters:
  • self – object.
  • data – 2D array to be plotted.
  • title – Figure title.
  • xlab – X axis label.
  • ylab – Y axis label.
  • xticks – X axis tick labels..
  • yticks – Y axis tick labels..
  • invert_yaxis – Invert Y axis if true.
  • colormap – matplotlib color map.
  • tick_size – Font size on tick labels.
  • tick_rotation – Rotation of tick labels.
Retuns:

None

Return type:

object

plot_scatter(data, x, y, title='', xlab='', ylab='', alpha=0.5, ylim=None, xlim=None)[source]

Generates a scatter plot from a pandas dataframe

Parameters:
  • data – Pandas dataframe
  • x – X axis data
  • y – Y axis data
  • title – Figure title
  • xlab – X axis label
  • ylab – Y axis label
  • alpha – opacity of data pionts
  • ylim – Y axis limit
  • xlim – X axis limit
Returns:

None

Return type:

object

Module contents