2-d line Plot

4 visualizaciones (últimos 30 días)
Martin Thomas
Martin Thomas el 28 de Ag. de 2020
Editada: Mehmed Saad el 30 de Ag. de 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.?

Respuestas (1)

Mehmed Saad
Mehmed Saad el 28 de Ag. de 2020
Editada: Mehmed Saad el 30 de Ag. de 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 comentario
Martin Thomas
Martin Thomas el 28 de Ag. de 2020
like this i need

Iniciar sesión para comentar.

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by