Getting two windows using figure & subplot when I only want one?
6 views (last 30 days)
Show older comments
I'm using the subplot feature and I'm getting two windows when I only want one? The issue I think is in the first few lines, I'm including everything just in case.
hold on
figure('Name','Question 8','position',[50 50 1000 600])
subplot(2,3,1)% Graph A
x = linspace(0,5);
y = exp(x);
plot(x,y,'bl')
axis([0 5 0 150])
xlabel('x axis')
ylabel('y axis')
title('A = [3] e^{x}')
%****************************************
subplot(2,3,2)% Graph B
y = log(x);
plot(x,y,'bl')
axis([0 5 -3 2])
xlabel('x axis')
ylabel('y axis')
title('B = [5] ln x')
%****************************************
subplot(2,3,3)% Graph C
y = log(1./x);
plot(x,y,'bl')
axis([0 5 -2 3])
xlabel('x axis')
ylabel('y axis')
title('C = [6] ln ^{1}/_{x}')
%****************************************
subplot(2,3,4)% Graph D
x = linspace(-5,5);
y = exp(-x);
plot(x,y,'bl')
xlabel('x axis')
ylabel('y axis')
axis([-5 5 0 150])
title('D = [4] e^{-x}')
%****************************************
subplot(2,3,5)% Graph E
x = linspace(1,5);
y = 1./x.^2;
plot(x,y,'bl')
xlabel('x axis')
ylabel('y axis')
axis([1 5 0 1])
title('E = [1] ^{1}/_{x}')
%****************************************
subplot(2,3,6)% Graph F
y = 1./x;
plot(x,y,'bl')
xlabel('x axis')
ylabel('y axis')
axis([1 5 0 1])
title('F = [2] ^{1}/_{x^2}')
%****************************************
hold off
0 Comments
Answers (2)
KALYAN ACHARJYA
on 11 Apr 2018
I think before first two lines, there is another figure (As "hold on" statement is there), so definitely return the 2 figure window
%Check Following lines
hold on
figure('Name','Question 8','position',[50 50 1000 600])
0 Comments
See Also
Categories
Find more on Subplots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!