How can I plot my figures like attached plots?
1 次查看(过去 30 天)
显示 更早的评论
Hi,
I want plot two graphs on same plot but with different x axis limits. Just given in the figure (a) attached to this question. How can I do it?
Second, if two plots are making crossover/overlapping at some points. Is it possible two a fill any color (yellow) in the overlapped area. as shown in the attached figure (b)?
Regards,
Ahmed
0 个评论
采纳的回答
Pavan Guntha
2021-7-27
Hi Nisar,
(1) You could use axes to add multiple axes to the same figure & then alter their properties as per your requirements. You could also use text command to add text to the plot. Example:
figure(1)
ax1 = axes;
ax2 = axes;
x1 = [1.95:0.1:2.95];
y1 = 2.5*ones(length(x1),1);
x2 = [-0.5:0.1:0.5];
y2 = 3*ones(length(x2),1);
plot(ax1,x1,y1,'r');
hold on
plot(ax2,x2,y2,'b');
hold off
ax2.YLim = [1 5];
ax1.YLim = ax2.YLim;
ax2.XLim = [-2 0.5];
ax1.XLim = [1.95 2.95];
ax2.Visible = "off";
set(ax1,'Yticklabel',{})
set(ax1,'Xticklabel',{})
x=0:0.1:10;
y1 = randn(1,length(x));
y2 = randn(1,length(x));
figure
hold all
plot(x,y1)
plot(x,y2)
patch([x fliplr(x)], [y1 fliplr(y2)], 'g')
hold off
Hope this helps!
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!