All Questions
Tagged with subplot matlab-figure
72 questions
2
votes
1
answer
106
views
How to change the legend string for different subplots?
I would like to add a legend to every subplot as shown below
each legend is theta_(1/2)=5, theta_(1/2)= 10, theta_(1/2)=15,...,theta_(1/2)=60. How can I change the number for each legend?
Q = [16,32,...
3
votes
1
answer
191
views
how to subplot n figures (pcolor) using for loop (matlab)
I have n saved fig files (all the figures are pcolor figure) and I want to plot all the figures in one new subplot (n X 2). Can anyone please help me out here? I will be really really grateful :)
%...
1
vote
1
answer
140
views
Save Matlab plot in readable manner
I have a plot with many subplots. Due to the high number, these plots get way too crowded to be analysed in Matlab, therefore I want to save them. However, no matter how high I choose the resolution ...
0
votes
1
answer
76
views
I have 3 images and i want to show them in 1 figure using subplot but they are too small, how can i make them bigger and more clear?
Here are the 3 images i want to include in 1 figure but with a greater size for each
subplot(1,3,1)
imshow(image);
title('ORIGINAL IMAGE');
subplot(1,3,2);
imshow(B);
title('IMAGE AFTER LOCAL ...
0
votes
1
answer
362
views
Why does MATLAB produce inconsistent Y-axes when generating multiple subplots?
I recently stumbled upon some weird behavior when trying to generate several subplots with a logarithmic y-scale. The subplots are constructed in a loop so that each subplot is generated exactly the ...
0
votes
1
answer
665
views
Matlab - Three (or more) Subplots with Single Colorbar with common Color Scale
I have at least three subplot which I need to have a single colorbar with common common range. I mean: one colorbar, rightside of the figure, common for all. However, after surfing the similar ...
0
votes
1
answer
662
views
Combining individual MATLAB plots into one figure: is modifying the script the best option?
The script below produces seven individual figures (each includes two plots). I would like to combine them into one big figure which would include all 14 plots. I think two solutions could be possible:...
1
vote
1
answer
846
views
Matlab subplot linkaxes is not lining up the axes as expected
I can't seem to get linkaxes to work (code is below). I am trying to get the subplots to line up, such that visually the x-axis is has the same range and width for both subplots. The misalignment is ...
2
votes
1
answer
1k
views
Is there any way to save a subplot to a variable in MATLAB?
In a piece of code in matlab, I generate a figure in which 5 different subplots appear. I was hoping it is possible to save these subplots to variables so I can later call upon one of these subplots ...
0
votes
1
answer
345
views
How to update a plot with two subplot in MATLAB?
I have a function in MATLAB and it plots two curves and I run it two times.
On the first time plot main curve as you can see in the red color (first plot) and after that turn the "hold on" and ...
1
vote
1
answer
512
views
Subplot two images with a vertical separator
I'm trying to create a figure with an image on the left (original image) and an image on the right (warped image) and a vertical line separating them, like this:
I've tried this by creating axes, ...
4
votes
1
answer
2k
views
How to link both y-axes in a yyaxis subplot?
I'm trying to individually link both y-axes in an yyaxis subplot. So far I'm only linking the right y-axes in the given code by calling linkaxes(g), where g are the axes handles. How can I also get ...
1
vote
1
answer
460
views
Maintain uniform axis limits in all three subplots in MATLAB [duplicate]
Following is the code I've written which involves a subplot command inside a for loop. I want each subplot to have the same y-axis limits, say 0 to 15. But the three plots have different (adjusted) y-...
1
vote
1
answer
754
views
Graphs is not plotting properly in the subplot in MATLAB
I have I have a data file which has 3 columns, 1st column is the field for the data, or you can say different index. 2nd column is the x-axis data, and the 3rd column is the y-axis data. Now I have ...
1
vote
1
answer
1k
views
duplicate axes in a figure
Sorry for a somewhat simple question. I am trying to generate a figure which displays the same animation but in different subplots. I'm starting simple and primarily focusing on duplicating the plot ...
0
votes
1
answer
103
views
Why does assigning an object to a subplot claim object is deleted?
I want to make 4 separate sub-figures each in a different position. my goal was to setup the figures first and following add objects to each figure with the goal to animate the objects later. ...
2
votes
1
answer
811
views
Cannot set a different colormap for each subplot
The colormap function in my code should give 3 different colormaps for 3 subplots. I have been using the polarmap colormap since last year to show the Doppler profile. I've just discovered that it is ...
0
votes
2
answers
458
views
make all right and left y-axis limits the same, respectively, for multiple subplots in figure
I have a subplot that appears as follows:
This is created as follows:
fig = figure;
nPlots = 3;
for p = 1:nPlots
ax(p) = subplot(1, nPlots, p);
x = 0:10*p;
y1 = max(x)-x.^1.1;
y2 = p*max(x)-...
1
vote
1
answer
901
views
Animation of figure with subplots using VideoWriter in MATLAB
I'm trying to create an animation file in MATLAB from a figure with 2 subplots using the VideoWriter. However, the avi file that I get includes only one of the subplots.
Here is the code:
clc
...
2
votes
2
answers
687
views
Error in MATLAB colorbar tick labeling?
I am plotting 9 subplots as shown in figure below with one color bar for three subplots.
Here I want to show the highest value in color bar as > value, surprisingly when I manually edit the tick ...
1
vote
2
answers
995
views
Positioning of annotations in subplots
I have to generate a plot of different sensor data. These should be printed in subplot each. After generating the plot it should be annotated with some rectangles to highlight different features. ...
0
votes
1
answer
60
views
Set size of image
I have created an image which is an output of the imagesc function in MATLAB.
My problem: How do I display a larger image of a transposed matrix and a much smaller regular plot as a subplot?
I have ...
0
votes
2
answers
2k
views
Combine figures with subplots into one figure
Having done several simulations on a cluster, where each simulation saves a figure, I want to combine these figures into a single figure.
For ease, assume we have the two figures:
x = 0:0.01:.2;
...
0
votes
2
answers
358
views
Colorbar resizes the subplots
I'm trying to plot 3 images side by side in MATLAB using subplot:
maxValue = 9;
minValue = 5;
figure(1)
subplot(1,3,1);
imshow(im1);
axis equal;
subplot(1,3,2);
imagesc(im2);colorbar;
caxis([...
2
votes
2
answers
125
views
Matlab. One script cell returns two figures
I'm trying to make a scriptfile with various script cells in it, separated by %%. The following code, returns one an old figure and one circle. However I want to clear the figure window so I only get ...
1
vote
1
answer
3k
views
Matlab: the title of the subplot overlaps the axis label above
I have 4x1 figure plot with 1 plot taking the upper half. I am viewing it on a relatively high-resolution 1600x1200 monitor, so Matlab should have no problem to fit in. This is especially odd ...
2
votes
1
answer
3k
views
Set two y-axis color in a subplot
In the matlab documentation it says that it is possible to change the Matlab axis colors in a two y-axis figure by doing the following:
fig = figure;
left_color = [.5 .5 0];
right_color = [0 .5 .5];
...
0
votes
2
answers
1k
views
How to use subplot, imshow, or figure in a loop, to show all the images?
Basically, I want to loop over all frames of video, subtract each frame from background image and display the result i.e subtractedImg either using subplot or figure.
vidObj = VideoReader('test3.mp4'...
4
votes
1
answer
29k
views
Same x-axis for two different subplots in MATLAB
I want have a line and bar plot in a figure in MATLAB. How can I have same x-axis for both graphs? The below bar plot x-axis should be same as above x-axis. I want retain the ability of comparing ...
2
votes
1
answer
2k
views
How to have a common label for all x and y axes in case of subplots?
I have used the following loop to get subplots:
for j=1:19;
Aj=B(j,:);
subplot(5,4,j);
plot(Aj,h)
end
For all these subplots, I need to have only one x-label and one y-label. How to do ...
4
votes
1
answer
241
views
Why does subplot position change?
Note: This issue occurs in 2016b in my case.
I try to make a figure with 3x4 subplots together, with tick
labels only on the leftmost and bottom subplots. However, when I run the code below, the first ...
12
votes
1
answer
21k
views
How to have a common legend for subplots?
I am trying to create a figure of subplots. I don't want the subplots to have legends but instead the figure to have an overall legend.
I read that it is possible either by adding a legend only to ...
0
votes
2
answers
298
views
How can I display a Biograph object in a subplot?
I want to plot some biographs in some subplots. Please help me to do this task.
There is my code:
cm = [0 1 1 0 0;1 0 0 1 1;1 0 0 0 0;0 0 0 0 1;1 0 1 0 0];
cm2 = [0 1 1 0 1;1 0 1 1 1;1 0 0 0 0;0 0 0 ...
-11
votes
2
answers
220
views
How to rewrite this Matlab 2014 code with axis-subplots to 2016?
Code which I wrote for Matlab 2014 but which I want to rewrite it to Matlab 2016 such that it becomes more compact, since it is extranous now
hFig3=figure('Units', 'inches');
hax3_b1=axes('Parent', ...
0
votes
1
answer
96
views
How to assign figure property with movegui() on Matlab subplot?
I need to assign the units inches for subplots (1-2).
I added movegui() for the figure, after which I started to get the error.
Without it, I donot get the error message.
Code
hFig3=figure('Units',...
0
votes
2
answers
4k
views
How to subplot + imagesc with a Position in Matlab?
Situation: change Position of a single subplot with imagesc
%% Matlab recommends this structure if axes(); in loop
a1 = subplot(1,2,1);
a2 = subplot(1,2,2);
while 1
plot(a1, rand(3)) ...
1
vote
1
answer
241
views
Change XTick in subplot not working
I have plenty of subplots I have to load and put all together using Matlab. I want to add personalized Ticks but my approach does not seem to work. My mwe is the following:
x = 1:1:1000;
r = rand(...
0
votes
1
answer
343
views
Multiple subplots with one dynamic super title using annotation
I am trying to use one super title for multiple subplots. I used annotation to accomplish that. The annotation is inside a loop. The problem is the annotation working fine when it is not dynamic but ...
0
votes
1
answer
93
views
MATLAB: subplot of one loop
I would like to plot the orbital velocity Vs Depth. This is successful with the following script:
clear all; clc; close all;
u = [
0.1841 0.6168 0.6889 0.3531 -0.2019 -0.6549 -0....
2
votes
1
answer
802
views
Matlab subplot shows tiny images
I have an algorithm that does a set of 8 image processing operations in an input image and then I want to show the output of each of them in a grid of 8 images. The problem is that I want to show ...
3
votes
1
answer
760
views
Matlab GUI, how to go back from subplot to a single plot?
I am having a simple GUI with two pushbuttons. One of them is plotting a single plot, one is plotting two subplots. However, once I push the subplot option, I cannot go back to the single plot. I am ...
1
vote
2
answers
435
views
Plotting using subplot with different x-axis for each plot
I am trying to plot figure with three plots inside it using subplot. The y-axis for all three plots is same from -1 to 1 while the x-axis is 2.5, 5, and 10 Respectively. The problem that is for all ...
-1
votes
1
answer
2k
views
How to align subplots to the centre of the figure when number of plots are less than rowsxcolumns?
Is it possible to align subplots to the centre of the figure when number of plots are less than rowsxcolumns? e.g;
If I use this:
figure
for pl=1:5
subplot(3,2,pl)
end
I get this result:
Can ...
5
votes
3
answers
7k
views
How to give a combined title for subplots? [duplicate]
I want to give a combined title to my subplots, instead of titling each plot individually.
e.g;
for pl=1:4
subplot(2,2,pl)
title('Test')
end
gives me this:
If I use this:
figure
title(...
1
vote
1
answer
4k
views
How to align MATLAB subplots?
My MATLAB subplots are not aligned perfectly, see the green rectangle in figure below. How to avoid this shift?
Here is what I am trying
clear all;
clc;
RF=RF_data(:,2:end);
figure
subplot(3,4,1)
...
0
votes
2
answers
2k
views
Tight subplot with colorbars and subplot's 3rd parameter in Matlab?
I would like to have a tight subplot i.e. minimum spacing between figures in the subplot where
you have subplot's 3rd parameter i.e. you can decide where the picture is going to be i.e. easy to move ...
1
vote
2
answers
1k
views
Puzzling behaviour of a specific figure-subplot conjunction in matlab
I wrote and am using a matlab program which, among other things, generate a large number of figures usually using the subplot command. [These figures represent molecule trajectories in single molecule ...
2
votes
1
answer
181
views
How to combine different figures in a Matlab script?
I am workin on a some sort of System test wherein i have a set of readings in the form of a .mat file.
It has a structure in the .mat file with one field as Measurement. It has several Arrays(e.g air ...
4
votes
3
answers
315
views
Exchange subplots in figure
I create a figure containing 4 subplots like:
y = [2 2 3; 2 5 6; 2 8 9; 2 11 12];
fig = figure
for i = 1 : 4
h(i) = subplot(1,4,i)
bar(y)
end
Now I would like to exchange the order of the ...
2
votes
1
answer
3k
views
Subplots within a Tabbed figure
For the following script, the subplots/plots are going behind the tab, when executed. How can this be fixed?
h.mainfig = figure();
h.tabgroup = uitabgroup(h.mainfig, 'Position', [.05 .1 .9 .8]);
...