Hi Giulia Slaviero,
I understand that you want to subplot multiple “scatterhist” plots on the same figure. In this case, to do so, after assigning the “uipanel” positions on the created figure, you can directly assign the parent container of the “scatterhist” in the function itself.
For your better understanding on the same, I am attaching a sample code below:
load fisheriris.mat;
x = meas(:, 1);
y = meas(:, 2);
% Create the first figure and uipanels
p = figure;
u1 = uipanel(p, 'position', [0, 0, 0.5, 1]);
u2 = uipanel(p, 'position', [0.5, 0, 0.5, 1]);
% Create the scatter plots with histograms on the side
h1 = scatterhist(x, y, 'Group', species, 'parent', u1);
h2 = scatterhist(x, y, 'Group', species, 'parent', u2);
The above code has been recreated in MATLAB version R2023a and R2020a and is providing the output as expected.
I hope this helps!
Regards,
Jaswanth.