Plotting#

utilities.plotting.bayesShadedPlot(project, result, options)#

Plots the shaded reflectivities from Bayes output from RAT

Examples

>>> bayesShadedPlot(project, result, 'interval', 65, 'q4', true);
Parameters:
  • project (projectClass) – An instance of the projectClass.

  • result (struct) – The result of the RAT Bayesian calculation.

  • options

    Keyword/value pair to configure plotting, the following are allowed
    • q4 (logical, default: false) indicates if the Y axis should plot Q^4

    • keepAxes (logical, default: false) indicates if the figure should be used without clearing axes.

    • interval (65 or 95, default: 95) Bayesian confidence interval to shade in the plot.

    • showLegend (logical, default: false) indicates if the legend should be shown.

utilities.plotting.cornerPlot(results, options)#

Creates a corner plot from chain data in the result struct, with or without smoothing. If selected, smoothing is via kernel density estimation.

Examples

>>> cornerPlot(result);
>>> cornerPlot(result, 'smooth', false);
>>> cornerPlot(result, 'smooth', false, 'params', [1, 3]);  % should plot 1st and 3rd fitted parameters only.
Parameters:
  • result (struct) – The result of the RAT Bayesian calculation.

  • options

    Keyword/value pair to configure plotting, the following are allowed
    • figure (‘matlab.ui.Figure’ or whole number, default: []) figure or number of the figure to use for the plot.

    • smooth (logical, default: true) indicates if KDE smoothing is applied to the plot.

    • params (1D ‘array of whole numbers’, ‘array of string’ or ‘cell array of char vectors’, default: []) indices or names of a subset of parameters to the plot.

utilities.plotting.plotChain(result)#

Plots MCMC chain from the result of a Bayesian RAT calculation.

Parameters:

result (struct) – The result from a Bayesian RAT calculation.

utilities.plotting.plotContours(x, y, parent, smooth)#

Draw a contour plot for the posteriors of two parameters.

Parameters:
  • x (double) – 1D array data for X axis.

  • y (double) – 1D array data for Y axis.

  • parent (matlab.graphics.axes.Axes or matlab.ui.Figure, or figure number, default: []) – axes or figure object to make plot on.

  • smooth (logical, default: false) – indicates if KDE smoothing is applied to the plot.

utilities.plotting.plotHists(result, options)#

Plots the Bayes histogram plot from the chain, with or without smoothing. If selected, smoothing is via a moving average algorithm.

Examples

>>> plotHists(result, 'smooth', false);
Parameters:
  • result (struct) – The result of the RAT Bayesian calculation.

  • options

    Keyword/value pair to configure plotting, the following are allowed
    • figure (‘matlab.ui.Figure’ or whole number, default: []) figure or number of the figure to use for the plot.

    • smooth (logical, default: true) indicates if moving average smoothing is applied to the plot.

utilities.plotting.plotRefSLD(project, result, options)#

Plots the reflectivity and SLD profiles

Examples

>>> plotRefSLD(problem, result, 'showGrid', true, 'q4', true);
Parameters:
  • project (projectClass) – An instance of the projectClass.

  • result (struct) – The result of the RAT calculation.

  • options

    Keyword/value pairs to configure plotting, the following are allowed
    • linearX (logical, default: false) indicates if the X axis should be linear scale instead of log.

    • q4 (logical, default: false) indicates if the Y axis should plot Q^4.

    • showErrorBar (logical, default: true) indicates if the error bar should be shown.

    • showGrid (logical, default: false) indicates if the grid should be shown.

    • showLegend (logical, default: true) indicates if the legend should be shown.

utilities.plotting.plotRefSLDHelper(data, noDelay, linearX, q4, showErrorBar, showGrid, showLegend)#

Helper function to plot the reflectivity and SLD profiles from plot event struct. Most users never need to use this function, rather use useLivePlot for live plotting or plotRefSLD for simple SLD plots.

Examples

>>> plotRefSLDHelper(data, false);

data is a struct created by the RAT plot event. This struct can be created as shown below:

>>> [projectStruct,~] = parseClassToStructs(project,controls);
>>>
>>> data.modelType = project.modelType;
>>> data.reflectivity = result.reflectivity;
>>> data.shiftedData = result.shiftedData;
>>> data.sldProfiles = result.sldProfiles;
>>> data.resampledLayers = result.resampledLayers;
>>> data.dataPresent = projectStruct.dataPresent;
>>> data.subRoughs = result.contrastParams.subRoughs;
>>> data.resample = projectStruct.resample;
>>> data.contrastNames = projectStruct.names.contrasts;

Where project is an instance of the projectClass, controls is an instance of controlsClass and result is the result struct from the RAT calculation.

Parameters:
  • data (struct) – A plot event struct.

  • noDelay (logical, default: true) – Indicates if draw should be delayed.

  • linearX (logical, default: false) – Indicates if the X axis should be linear scale instead of log.

  • q4 (logical, default: false) – Indicates if the Y axis should plot Q^4.

  • showErrorBar (logical, default: true) – Indicates if the error bar should be shown.

  • showGrid (logical, default: false) – Indicates if the grid should be shown.

  • showLegend (logical, default: true) – Indicates if the legend should be shown.

class utilities.plotting.useLivePlot(figureId)#

Sets up a live plot on a given figure. The live plot listens for plot events from the RAT calculation and redraws the plot every time an event is received.

Examples

>>> useLivePlot();   % Opens a new figure for plot
>>> useLivePlot(1);  % Use figure 1 for plot
Parameters:

figureId ('matlab.ui.Figure' or whole number, default: []) – The number of the figure to use for the live plot.