UQWorld

Error with uq_plot

Hello,

I have recently attempted to use the Bayesian inference tool. To start, I simply ran the first example problem, i.e., uq_Example_Inversion_01_Beam. I get this error with uq_display which is the same as https://uqworld.org/t/error-with-uq-display/351 . The solution in this post is to reinstall Matlab, which I do not want to do.

I ran another inference problem, this time, uq_Example_Inversion_04_PredPrey.m. The script breaks at uq_display(myBayesianAnalysis, ‘trace’, 1) line. And, I get the following error,

Data must be a single matrix Y or a list of pairs X,Y.

Error in uq_traceplot (line 125)
uq_plot(…

Error in uq_AIES (line 208)
plotHandle = uq_traceplot(Sample(1:ii,plotParameters,:),…

Error in uq_inversion (line 91)
Results.LogLikeliEval] = uq_AIES(…

Error in uq_initialize_uq_inversion (line 708)
uq_runAnalysis(CurrentAnalysis);

Further digging into the problem, I realize there is some problem with uq_plot because the following breaks too.

clearvars
rng(1,‘twister’)
uqlab
InputOpts.Marginals(1).Type = ‘Uniform’;
InputOpts.Marginals(1).Parameters = [0 1];
InputOpts.Marginals(2).Type = ‘Uniform’;
InputOpts.Marginals(2).Parameters = [0 1];
myInput = uq_createInput(InputOpts);
uq_figure;
ax=gca;
X_MC = uq_getSample(80,‘MC’);
uq_plot(ax, X_MC(:,1), X_MC(:,2), ‘.’, ‘MarkerSize’, 10)
xlabel(’$\mathrm{X_1}$’, ‘Interpreter’,‘latex’)
ylabel(’$\mathrm{X_2}$’,‘Interpreter’,‘latex’)

It seems like uq_plot is not able to handle the axes handle. Please help me to rectify this.
Moreover, the axis labels need the latex interpreter option, which I found missing in several codes (e.g., uq_traceplot.m).

Apparently, adding the path of UQLabCore_Rel1.0.0\lib\uq_graphics folder to the script solved the problem. Although the entire UQLabCore_Rel1.0.0 path with sub-folders are already in my Matlab search path.

Hi @ArjunC,

Welcome to UQWorld!

Great!

Because I could not reproduce the problem just like the previous post on the similar issue. There are differences in appearances between plots from older MATLAB (< R2014b) and newer ones, but nothing that will break the code.

By the way, regarding your remark on the interpreter, because LaTeX interpreter is used across UQLab plotting functions, it is not put in the individual functions. Instead there’s a common formatting function that deals with this.