1

I have created a tabbed Panel, in this Panel i want to create a Plot with multiple axes. To do this I am working with "addaxis" from https://de.mathworks.com/matlabcentral/fileexchange/9016-addaxis.

My code:

obj.plot=axes('Parent', obj.tab, 'Position',[0.05, 0.15 , 0.92, 0.83], 'Units', 'normalized');
 x = 0:.1:4*pi;
 plot(x,sin(x));
 addaxis(x,sin(x-pi/3));
 addaxis(x,sin(x-pi/2),[-2 5],'linewidth',2);
 addaxis(x,sin(x-pi/1.5),[-2 2],'v-','linewidth',2);
 addaxis(x,5.3*sin(x-pi/1.3),':','linewidth',2);

 addaxislabel(1,'one');
 addaxislabel(2,'two');
 addaxislabel(3,'three');
 addaxislabel(4,'four');
 addaxislabel(5,'five');

 addaxisplot(x,sin(x-pi/2.3)+2,3,'--','linewidth',2);
 addaxisplot(x,sin(x-pi/1),5,'--','linewidth',2);

 legend('one','two','three','four','five','three-2','five-2');

But when i execute the code the axes are missing. When i create a figure:

figure()
 x = 0:.1:4*pi;
 plot(x,sin(x));
 addaxis(x,sin(x-pi/3));
 addaxis(x,sin(x-pi/2),[-2 5],'linewidth',2);
 addaxis(x,sin(x-pi/1.5),[-2 2],'v-','linewidth',2);
 addaxis(x,5.3*sin(x-pi/1.3),':','linewidth',2);

 addaxislabel(1,'one');
 addaxislabel(2,'two');
 addaxislabel(3,'three');
 addaxislabel(4,'four');
 addaxislabel(5,'five');

 addaxisplot(x,sin(x-pi/2.3)+2,3,'--','linewidth',2);
 addaxisplot(x,sin(x-pi/1),5,'--','linewidth',2);

 legend('one','two','three','four','five','three-2','five-2');

everything is fine.

I added two screenshots.

enter image description here

enter image description here

Gabriel
  • 31
  • 2

0 Answers0