Uq_display_uq_inversion: Determine limits for scatter plots for posteriori samples from the posteriori samples instead of using prior samples

Dear @paulremo , dear all,

In UQLab 1.4, the values given as parameter for 'Limits' limits are no longer ignored by the function uq_scatterDensity, such that the values in the corresponding calls to this function in uq_display_uq_inversion are now used during the creation of the scatter plot.

I am not sure, if this is a planed behavior or an error, but it holds that the limits for the scatter plots for the prior samples and for the posterior sample are both computed from the prior samples. In UQLab 1.3 these values were ignored by uq_scatterDensity, but this is no longer the case in UQLab 1.4, as one can observe e.g. by considering the scatter plots in the 1.4.version of UserManual_Bayesian.pdf. In these plots, the plot ranges in the prior plot and in the posterior plots are the same, see also my version of the scatter plots in Figure 9:

I do not like this same plot limits approach, since the variation of the posterior samples
(after removing the burn-In phase and maybe also bad chains) may be much smaller then the
variation of the prior samples and are invisible in plots using the limits determined from
the prior samples. Therefore, I have replaced in my copy of uq_display_uq_inversion.m
in the line 297 allPlotPoints = [PriorSample; plotPointCollection]; by allPlotPoints = [PostSample; plotPointCollection];. Thanks to this modification, the resulting scatter plot for the posterior samples changed to


In contrast to the posterior scatter plot above, one can really see the variation of E.

Hence, I suggest to perform this change also in the official version of uq_display_uq_inversion and to replace in line 314 'Limits', [min(PriorSample);max(PriorSample)],... by
'Limits', [min(PostSample);max(PostSample)],... .

If this same plot limits approach behavior is planed, I would suggest to add to the flags considered in Further plot possibilities for results of Bayesian inversion (Suggestions and code example) - #2 by paulremo a flag like ‘scatter.reusePriorlimits’ that allows to activate/ deactivate this approach.


Hi @olaf.klein

This behavior is indeed on purpose to show the information gain from updating. However, I agree with you that a flag option would make more sense to allow visual inspection of the posterior distribution in cases of large information gain, like the one you mention in your post.

Can you add a reference to this post to the original post here?