From: Mehmet Demirel on 20 May 2010 12:58 Hello Serval, I tried to use your code for an other y data. However the Y axis has always 0:0.1:1 values overwritten on my real data. X axis is perfect but Y is not.. I tried to add this part but still no progress. Could you comment on Y axis? ax(3)=axes('position',get(ax(2),'position'),'Visible', 'off'); set(ax(3),'Ylim',[1,900],'YTick',0:100:900,'YTicklabel',''); Regards, Mehmet serval <serxval(a)yahoo.com> wrote in message <ef3c1ee.2(a)webcrossing.raydaftYaTP>... > Hi again Ri. In the last mail I made a mistake (I repeated your > code). Here is the good one!. > > Thank you very much for your suggestion!: It was the best one I've > recived. However I needed to do some minor changes to make it work > exactly as I wanted. Here is the final solution for the problem: > > %============================================= > close all > clear all > monthlim=[1,31,59,90,120,151,181,212,243,273,304,334,365]; > monthlim2=0.5*diff(monthlim)+monthlim(1:end-1); > xticklabels=['J';'F';'M';'A';'M';'J';'J';'A';'S';'O';'N';'D']; > > y=rand(1,365); > > figure(1) > ax(1)=newplot; > set(gcf,'nextplot','add'); > set(ax(1),'Xlim',[1,365],'XTick',monthlim2,'XTicklabel',xticklabels); > ax(2)=axes('position',get(ax(1),'position'),'Visible', 'off'); > plot(1:365,y) > set(ax(2),'Xlim',[1,365],'XTick',monthlim,'XTicklabel',''); > grid on > %============================================= > > Serval. > > ...................... > Ri wrote: > > > > > > Hi Serval. > > > > Can the following help you? > > > > monthlim= > > [1,31,59,90,120,151,181,212,243,273,304,334,365]; > > xticklabels= > > ['J';'F';'M';'A';'M';'J';'J';'A';'S';'O';'N';'D']; > > > > y=rand(1,365); > > > > ax(1)=newplot; > > set(gcf,'nextplot','add'); > > set(ax(1),'Xlim',[1,365],'XTick',monthlim,'XTicklabel',monthlim); > > > > monthlim2=0.5*diff(monthlim)+monthlim(1:end-1); > > ax(2)=axes('position',get(ax(1),'position')); > > > > plot(1:365,y) > > > > set(ax(2),'XAxisLocation','top'); > > > set(ax(2),'Xlim',[1,365],'XTick',monthlim2,'XTicklabel',xticklabels) > > ;
|
Pages: 1 Prev: Plot the edges of a surface Next: A question about boxplot |