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.

static best_filename(result) str

Returns the filename of the best fit plot.

Parameters:

result (FittingResult) – The result to plot

Returns:

path to the saved file

Return type:

str

static plot_2d_data(categories, title, options, figures_dir) str

Show 2d plots for 2d data fitting, with contour plots. One plot is shown for the best minimizer for each cost function.

Parameters:
  • categories (dict[str, list[FittingResults]]) – The results to plot

  • 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

static plot_multistart(results, options, figures_dir) str

Creates a plot showing the results categorized by cost function, software and minimizer. The plots summarize the performance of different minimizers with multiple starting conditions. The plots generated are color coded. The blue traces are the ones that achieved a good fit while the red traces are the ones that did not.

Parameters:

results (dict[str, list[FittingResults]]) – All the results sorted by cost function, software and minimizer.

Returns:

The path to the new plot

Return type:

str

plot_posteriors(result) str

Use Plotly to plot estimated posterior pdfs.

Parameters:

result (FittingResult) – The result to plot

Returns:

path to the saved file

Return type:

str

static plot_residuals(categories, title, options, figures_dir) str

Create a comparison plot showing residuals for all fits, while emphasizing the residuals for the best fit.

Parameters:
  • categories (dict[str, list[FittingResults]]) – The results to plot

  • 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

static plot_summary(categories, title, options, figures_dir) str

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

plotly_fit(df_fit) dict[str, str]

Uses plotly to plot the calculated fit, along with the best fit. Stores the plot in a file

Parameters:

df_fit (Pandas dataframe) – A dataframe holding the data

Returns:

A dictionary of paths to the saved files

Return type:

dict[str, str]

Writes an html file for the figure passed as input and includes link to the relevant plotly.js file.

Parameters:
  • fig (plotly.graph_objs._figure.Figure) – Figure to be saved

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

  • htmlfile (str) – Name of the figure

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