falcon_alliance.plotting

class falcon_alliance.plotting.plotter.AppliedFunction(applied_result: list)

Represents an applied function, utilized for plotting.

for_each(to_apply: Callable) AppliedFunction

Applies a function to each element in a 2D list.

Parameters:

to_apply – A callable which is called with each element in a 2D list.

Returns:

An AppliedFunction instance containing the new applied list.

Return type:

AppliedFunction

class falcon_alliance.plotting.plotter.Plotter(auto_plot: bool = True, default_color: str = '#FBBB00')

Helper class to make visualizing data easier. Uses matplotlib and abstracts the details, however the user can extend what is given and FalconAlliance’s plotting features are easily extendable overall.

default_color

Represents the default color to use for plots. #FBBB00 by default.

Type:

str

auto_plot

Represents whether or not the axes should be plotted in the function itself.

Type:

bool

bar_plot(x: Iterable[Any], height: Iterable[Any], auto_plot: bool | None = None, title: str = '', color: str = '', secondary_color: str = '#262626') Tuple[Figure, Axes]

Plots the FalconAlliance data given into a bar plot.

Parameters:
  • x (Iterable[Any]) – Data containing the data for the x-axis.

  • height (Iterable[Any]) – Data containing the height of each “bar” on the bar chart (y-axis data).

  • auto_plot (bool) – Determines whether or not to plot the axes automatically in the function itself.

  • title (str) – The title for the plot.

  • color (str) – Color to use when plotting. #FBBB00 by default.

  • secondary_color (str) – Color to use for the edge color of the bar chart. #262626 by default.

Returns:

Returns a plt.Figure object representing the figure created for the plot and a plt.Axes object representing the axes the plot is on.

Return type:

Tuple[plt.Figure, plt.Axes]

histogram(x: Iterable[Any], bins: int, auto_plot: bool | None = None, title: str = '', color: str = '', secondary_color: str = '#262626') Tuple[Figure, Axes]

Plots the FalconAlliance data given into a histogram.

Parameters:
  • x (Iterable[Any]) – Iterable containing the data for the x-axis.

  • bins (int) – The number of “bins” to plot in the histogram (the buckets, essentially).

  • auto_plot (bool) – Determines whether or not to plot the axes automatically in the function itself.

  • title (str) – The title for the plot.

  • color (str) – Color to use when plotting. #FBBB00 by default.

  • secondary_color (str) – Color to use for the edge color of the bins. #262626 by default.

Returns:

Returns a plt.Figure object representing the figure created for the plot and a plt.Axes object representing the axes the plot is on.

Return type:

Tuple[plt.Figure, plt.Axes]

pie_chart(wedges: Iterable[int], explode: Iterable[int] | None = None, labels: Iterable[str] | None = None, auto_plot: bool | None = None, title: str = '', color: str = '', secondary_color: str = '#262626') Tuple[Figure, Axes]

Plots the FalconAlliance data given into a pie chart.

Parameters:
  • wedges (Iterable[int]) – Data containing the size of each wedge of the pie chart.

  • explode (Iterable[int], optional) – Iterable of the same length as wedges pertaining to how much to offset each wedge.

  • labels (Iterable[str], optional) – Labels for each wedge.

  • auto_plot (bool) – Determines whether or not to plot the axes automatically in the function itself.

  • title (str) – The title for the plot.

  • color (str) – Color to use when plotting. #FBBB00 by default.

  • secondary_color (str) – Color to use for the gradient of the pie chart. #262626 by default.

Returns:

Returns a plt.Figure object representing the figure created for the plot and a plt.Axes object representing the axes the plot is on.

Return type:

Tuple[plt.Figure, plt.Axes]

plot(x: Iterable[Any], y: Iterable[Any], fill_between: Tuple[Iterable[Any], Iterable[Any]] = (), auto_plot: bool | None = None, title: str = '', smoothen: bool = False, color: str = '') Tuple[Figure, Axes]

Plots FalconAlliance data into a readable and understandable format.

Parameters:
  • x (Iterable[Any]) – Data to plot on the x axis.

  • y (Iterable[Any]) – Data to plot on the y axis.

  • fill_between (Tuple[Iterable[Any], Iterable[Any]]) – Fills betweeen the first and second elements in the tuple on the plot.

  • auto_plot (bool) – Determines whether or not to plot the axes automatically in the function itself.

  • title (str) – The title for the plot.

  • smoothen (bool) – Determines whether or not to smoothen a line when plotting.

  • color (str) – Color to use when plotting. #FBBB00 by default.

Returns:

Returns a plt.Figure object representing the figure created for the plot and a plt.Axes object representing the axes the data was plotted on.

Return type:

Tuple[plt.Figure, plt.Axes]

scatter(x: Iterable[Any], y: Iterable[Any], auto_plot: bool | None = None, title: str = '', color: str = '', secondary_color: str = '#262626', use_cmap: bool = True, marker_size: int | float = 36.0) Tuple[Figure, Axes]

Plots the FalconAlliance data given into a scatter plot.

Parameters:
  • x (Iterable[Any]) – Data to plot on the x axis.

  • y (Iterable[Any]) – Data to plot on the y axis.

  • auto_plot (bool) – Determines whether or not to plot the axes automatically in the function itself.

  • title (str) – The title for the plot.

  • color (str) – Color to use when plotting. #FBBB00 by default.

  • secondary_color (str) – Color to use for the higher points on the scatter plot. #262626 by default.

  • use_cmap (bool) – Boolean representing whether or not to use a colormap when plotting the scatter plot. True by default.

  • marker_size (int, float) – Number representing what to set the marker size (increases/decreases size of individual points).

Returns:

Returns a plt.Figure object representing the figure created for the plot and a plt.Axes object representing the axes the plot is on.

Return type:

Tuple[plt.Figure, plt.Axes]

violin_plot(data: Iterable[List[Any]], positions: Iterable[Any], auto_plot: bool | None = None, title: str = '', color: str = '', secondary_color: str = '#262626', style_plot: bool = True) Tuple[Figure, Axes]

Plots the FalconAlliance data given into a violin plot.

Parameters:
  • data (Iterable[List[Any]) – Array-like data for the violin plot itself.

  • positions (Iterable[Any]) – Data containing the positions for each ‘violin’ (the x-axis for vertical violin plots, basically).

  • auto_plot (bool) – Determines whether or not to plot the axes automatically in the function itself.

  • title (str) – The title for the plot.

  • color (str) – Color to use when plotting. #FBBB00 by default.

  • secondary_color (str) – Color to use for the edge color of the violins. #262626 by default.

  • style_plot (bool) – Boolean representing whether or not to use a custom style for the violin plot. Will default to matplotlib’s standard style for a violin plot if False.

Returns:

Returns a plt.Figure object representing the figure created for the plot and a plt.Axes object representing the axes the plot is on.

Return type:

Tuple[plt.Figure, plt.Axes]

falcon_alliance.plotting.plotter.apply(function: Callable, **kwargs) AppliedFunction

Applies keyword arguments to the function passed in, utilized for plotting.

Parameters:
  • function (Callable) – A function to apply the kwargs to.

  • **kwargs – The keyword argument name is the corresponding keyword argument for the function and the value is either a certain value that tells the function to keep that value constant or an iterable representing the different values to call the function with.

Returns:

A custom class containing a list of all the return values of the function based on the values that were applied to the function.

Return type:

AppliedFunction