# 2-d line Plot

조회 수: 1(최근 30일)
Martin Thomas 2020년 8월 28일
편집: Mehmed Saad 2020년 8월 30일
I have to plot a graph,
figure()
plot(x,y)
xlabel('x')
ylabel('y')
But i have to add one more x label in this same plot, it should be like a line under the x axis. How is it possible.?

댓글을 달려면 로그인하십시오.

### 답변(1개)

편집: Mehmed Saad 2020년 8월 30일
figure,plot(1:10),xlabel({'1st line','2nd line'})

#### Edit1:

This is one short method (zoom in zoom out) will not work properly
close all
x1 = 11:20;
x2 = 1:10;
y =rand(1,10);
fig = figure(1);
ax2 = axes(fig,'Position',[0.1300 0.1000 0.7750 0.8000]);
plot(x2,y,'Parent',ax2,'Visible','off')
xlim([min(x2),max(x2)]),xlabel('2nd X-Axis','Color','r');
%
ax1 = axes(fig,'Position',[0.1300 0.2000 0.7750 0.7000]);
plot(ax1,x1,y);xlim([11,20]);
xlim([min(x1),max(x1)]),xlabel('1st X-Axis','Color','b');
ax1.XLabel.Position(2) = ax1.YLim(1)-0.05;
ax2.Visible = 'off';
ax2.XAxis.Visible = 'on';
ax2.XAxis.Color = 'r';
ax1.XAxis.Color = 'b';
ax2.XLabel.Position(2) = ax2.YLim(1)-0.05;
##### 댓글 수: 1표시 없음숨기기 없음
Martin Thomas 2020년 8월 28일
like this i need

댓글을 달려면 로그인하십시오.

### 범주

Find more on Line Plots 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!

Translated by