1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| function [ax,hl1,hl2] = plotxx(x1,y1,x2,y2,xlabels,ylabels,xlim1,xlim2,minY,maxY,nb_tick,date_label)
if length(ylabels) == 1
ylabels{2} = ' ';
endxlabels
error('Input xlabels must be a cell array')
elseif ~iscellstr(ylabels)
error('Input ylabels must be a cell array')
end
hl1=line(x1,y1,'Color','k');
xlim([xlim1(1) xlim1(2)])
ylim([minY maxY]);
ax(1)=gca;
set(ax(1),'XColor','k','YColor','k');
set(ax(1),'Xtick',0:6:nb_tick*24);
set(ax(1),'XtickLabel',date_label,'FontSize',11);
ax(2)=axes('Position',get(ax(1),'Position'),...
'XAxisLocation','top',...
'YAxisLocation','right',...
'Color','none',...
'XColor','k','YColor','k');
set(ax,'box','off')
hl2=line(x2,y2,'Color','r','Parent',ax(2),'lineW',2);
xlim([xlim2(1) xlim2(2)])
ylim([minY maxY])
set(get(ax(2),'xlabel'),'string',xlabels{2},'fontsize',11,'fontweight','bold')
set(get(ax(1),'ylabel'),'string',ylabels{1},'fontsize',11,'fontweight','bold')
set(get(ax(2),'ylabel'),'string',ylabels{2},'fontsize',11,'fontweight','bold')
set(ax(2),'FontSize',11)
grid |
Partager