fitbenchmarking.results_processing.plots module

Higher level functions that are used for plotting the fit plot and a starting guess plot.

class fitbenchmarking.results_processing.plots.Plot(best_result, options, figures_dir)

Bases: object

Class providing plotting functionality.

best_fit_plot_options = {'color': '#6699ff', 'linestyle': ':', 'linewidth': 3, 'marker': '', 'zorder': 3}
data_plot_options = {'color': 'black', 'label': 'Data', 'linestyle': '', 'linewidth': 1, 'marker': 'x', 'zorder': 0}
fit_plot_options = {'color': '#99ff66', 'linestyle': '-', 'linewidth': 3, 'marker': '', 'zorder': 2}
format_plot()

Performs post plot processing to annotate the plot correctly

ini_guess_plot_options = {'color': '#ff6699', 'label': 'Starting Guess', 'linestyle': '-', 'linewidth': 3, 'marker': '', 'zorder': 1}
plot_best(result)

Plots the fit along with the data using the “best_fit” style and saves to a file

Parameters

result (FittingResult) – The result to plot

Returns

path to the saved file

Return type

str

plot_data(errors, plot_options, x=None, y=None)

Plots the data given

Parameters
  • errors (bool) – whether fit minimizer uses errors

  • plot_options (dict) – Values for style of the data to plot, for example color and zorder

  • x (np.array) – x values to be plotted

  • y (np.array) – y values to be plotted

plot_fit(result)

Updates self.line to show the fit using the passed in params. If self.line is empty it will create a new line. Stores the plot in a file

Parameters

result (FittingResult) – The result to plot

Returns

path to the saved file

Return type

str

plot_initial_guess()

Plots the initial guess along with the data and stores in a file

Returns

path to the saved file

Return type

str

classmethod plot_summary(categories, title, options, figures_dir)

Create a comparison plot showing all fits from the results with the best for each category highlighted.

Parameters
  • categories (dict[str, list[FittingResults]]) – The results to plot sorted into colour groups

  • title (str) – A title for the graph

  • options (utils.options.Options) – The options for the run

  • figures_dir (str) – The directory to save the figures in

Returns

The path to the new plot

Return type

str

summary_best_plot_options = {'linestyle': '-', 'linewidth': 2, 'marker': '', 'zorder': 2}
summary_plot_options = {'alpha': 0.5, 'linestyle': '-', 'linewidth': 1, 'marker': '', 'zorder': 1}