3.12.4. Plotting Funcitons

Note

The plotting functions are not part of the scm.params package namespace and consequently will not be imported by default. They can, however, be invoked by the plotting callbacks and when calling params plot from the command line.

plot_residuals(datafile, outfile='default', bins=None, xmax=None, fontsize=22, dpi=200, _verbose=True, **kw)

Plots a residuals histogram from any *residuals.dat.

Parameters:
datafile : str
Path to *residuals.dat file
outfile : str
Filepath to the .png image to be written. Defaults to datafile.png.
bins : int
Number of bins for the histogram plot, Defaults to len(x)/100 or 10, whatever is larger.
xmax : optional, float > 0
If provided, will set the x-range to (-xmax, xmax).
fontsize : float
Font size
dpi : int
DPI of the outfile
plot_contributions(datafile, outfile='default', cutmin='default', n_max=100, sort=True, print_jobids=True, fontsize=20, dpi=200, _verbose=True, **kw)

Generates a barplot based on the contributions from the last evaluate() call, depicting each cost function entry and it’s respective contribution to the total cost function (see Optimization.writefrequency).

Parameters:
datafile : str
Path (and fname) where the plot should be stored. Will print the plot on screen (using matplotlib TkAgg) if None.
outfile : str
Filepath to the .png image to be written. Defaults to datafile.png.
cutmin : ‘default’, float
Entries with a contribution smaller than cutmin will not be plotted. If set to default, will set cutmin = 5 * 100/N_entries (plotting everything that is 5 times larger than the uniform distribution).
n_max : int
Maximum number of entries to show. Will show the entries with the largest contributions first.
sort : bool
Whether to sort the entries by descending contributions or not. If None, will sort by the entries’ index in the cost function instead.
print_jobids : bool
Whether to print the jobids of each entry on top of each bar.
fontsize : float
Font size.
dpi : int
DPI of the outfile
plot_history(datafile, outfile='default', linewidth=2.0, fontsize=20, markers=False, markersize=5, nan_to_zero=False, dpi=120, yscale='linear', _verbose=True, **kw)

Plot the cost function values of test / validation sets as a function of total evaluations from a history.dat.

Parameters:
datafile : str
Path to history.dat
outfile : str
Filepath to the .png image to be written. Defaults to datafile.png.
linewidth : float
Line width
fontsize : float
Font size of the plot
markers : bool
Whether to plot markers on top of the lineplot or not.
markersize : bool
Marker size, if markers==True
nan_to_zero : bool
Whether to convert possible nan / inf in the validation cost values to 0 to guarantee a continuous plot.
dpi : int
DPI of the outfile
yscale : ‘linear’, ‘log’, ‘symlog’, ‘logit’
The pyplot.yscale value