MATLAB: Sub-plots properties

sub-plots properties

Hi. I have 4 MATLAB figures, using them as sub-plots I want to create a new figure. These 4 figures have a larger marker size and line width.
How can, I change/modify the line width, marker size in these subplots? I want to add labels "a, b, c, d" on the bottom left of figure. Also, I want to add some text on top left corner of each sub-plot figure.

Best Answer

Hello SS,
First I recommend reading this useful documentation.
In this case you want 4 subplots, so you subplots should be in subplot(2,2,1); subplot(2,2,2); subplot(2,2,3); subplot(2,2,4). as you can see the first and the second number is constant because you want 4 subplots. In fact, 2 and 2 define you want 2 in the row and 2 in the column which is four actually. the second number 1,2,3,4 adjusts the place of your subplots among each other. you can found more explanation in the document that I was mention above.
then you can consider each subplot as a plot and do what ever you previously doing in plot, like marker size changing.
In your case you can use this:
figure;
%first subplot
subplot(2,2,1);
plot(something, 'linewidth',1); %instead of 'something' write your data. you can set linewidth
xlabel('something')
ylabel('something')
%put text box code for each subplot here (read above for more information)
%second subplot
subplot(2,2,2);
plot(somehting, 'linewidth',1);
xlabel('something')
ylabel('something')
%third subplot
subplot(2,2,3);
plot(somehting, 'linewidth',1);
xlabel('something')
ylabel('something')
%fourth subplot
subplot(2,2,4);
plot(somehting, 'linewidth',1);
xlabel('something')
ylabel('something')
You can add a text box for each subplot just under the end of code for each other using the useful information in this question:
For example as you can see in this question:
figure;
plot(1:10); % create a simple line plot
a = gca; % get the current axis;
% set the width of the axis (the third value in Position)
% to be 60% of the Figure's width
a.Position(3) = 0.6;
% put the textbox at 75% of the width and
% 10% of the height of the figure
annotation('textbox', [0.75, 0.1, 0.1, 0.1], 'String', "pi value is " + pi)