trappy.plotter.PlotLayout module

This module implements functionality related to the arrangement of the plots on the underlying plotting backend.

class trappy.plotter.PlotLayout.PlotLayout(cols, num_plots, **kwargs)[source]

Bases: object

Parameters:
  • cols (int) – The number of columns to draw
  • num_plots (int) – The total number of plots

The linear co-ordinate system \([0, N_{plots}]\) is mapped to a 2-D coordinate system with math:N_{rows} and \(N_{cols}\) such that:

\[N_{rows} = \frac{N_{cols}}{N_{plots}}\]
finish(plot_index)[source]

Delete the empty cells

Parameters:plot_index (int) – Linear index at which the last plot was created. This is used to delete the leftover empty plots that were generated.
get_2d(linear_val)[source]

Convert Linear to 2D coordinates

Parameters:linear_val (int) – The value in 1-D co-ordinate
Returns:Converted 2-D tuple
get_axis(plot_index)[source]

Get the axes for the plots

Parameters:plot_index – The index for which the axis is required. This internally is mapped to a 2-D co-ordinate
Returns:matplotlib.axes.Axes instance is returned
get_fig()[source]

Return the matplotlib figure object

Returns:matplotlib.figure