Creating a figure with multiple raincloud plots with the same y-axis

13 views (last 30 days)
I have made 4 raincloud plots which are subplotted as one image (attached image). However, I would like to have one x-y graph, with the 4 raincloud plots adjusted as one on top of the other, whereby the y-axis will not have the y values but they will identified the 4 groups.
Any help?

Answers (1)

William Rose
William Rose on 28 Nov 2022
It would help if you woudl provide a drawing or other image of what you want.
It would also help if you attach the code you use to make the raincloud plot.
mu=[5 5.5 6]'; sigma=[.5 .45 .55]';
for i=1:3
hold on;
x2 = [x, fliplr(x)];
inBetween = [base, fliplr(yoff)];
set(gca,'YTickLabel',[]); %erase the numbers on y axis
Thank you to @Image Analyst for the code to shade between two plots.
Try it. Good luck.
William Rose
William Rose on 1 Dec 2022
Since I do not have the function raincloud_plot(), I cannot expriment with it, to learn how it behaves, or what options and properties it has.
The code you suggested above could be made into a loop as follows:
f3 = figure('Position', fig_position);
colorspec=[0.2 0.67 0; 1 0.26 0; 0.63 0 1; 0.01 0.42 1]
for i=1:4
subplot(2, 2, i)
h(i) = raincloud_plot(d{i}, 'box_on', 1, 'color',colorspec(i,:), 'MarkerFaceColor',colorspec(i,:));
titlestr=sprintf('Visit %d',i); title(titlestr);
set(gca, 'XLim', [300 1400]);
box off
If you do not plan to access the properties of each raincloud plot, then you do not need the handles h(i). In that case, you could replace the line h(i)=raincloud_plot(...); with raincloud_plot(...); .

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by