2-d line Plot

4 vues (au cours des 30 derniers jours)
Martin Thomas
Martin Thomas le 28 Août 2020
Modifié(e) : Mehmed Saad le 30 Août 2020
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.?

Réponses (1)

Mehmed Saad
Mehmed Saad le 28 Août 2020
Modifié(e) : Mehmed Saad le 30 Août 2020
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 commentaire
Martin Thomas
Martin Thomas le 28 Août 2020
like this i need

Connectez-vous pour commenter.

Catégories

En savoir plus sur Graphics Object Properties dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by