Remove double axis-label

7 visualizzazioni (ultimi 30 giorni)
Karl
Karl il 3 Ott 2013
Risposto: Karl il 16 Ott 2013
Does anybody know how I can remove the original axis-numbers "5", "10" etc from the x-axis in the figure that is generated by the commands below? As you can see, the commands produce a double axis-label. I guess it happends because both series has its own x-axis and that the commands only replaces one of these axis so that one is left in addition to the new axis. I wish only to have one x-axis label and that is the new one.
A = rand(43,1);
B = rand(43,1);
Aar = {'2003K1','2003K2', '2003K3', '2003K4', '2004K1', '2004K2', '2004K3', '2004K4', '2005K1', '2005K2', '2005K3', '2005K4', '2006K1', '2006K2', '2006K3', '2006K4', '2007K1', '2007K2', '2007K3', '2007K4', '2008K1', '2008K2', '2008K3', '2008K4', '2009K1', '2009K2', '2009K3', '2009K4', '2010K1', '2010K2', '2010K3', '2010K4', '2011K1', '2011K2', '2011K3', '2011K4', '2012K1', '2012K2', '2012K3', '2012K4', '2013K1', '2013K2', '2013K3'}
start=1; stop =length(Aar);
a=1; b=1+stop-start; intervall = 1; out=a:intervall:b;
[AX,H1,H2] = plotyy(out,A(start:stop),out,B(start:stop),'plot');
set(get(AX(1),'Ylabel'),'String','A','Color', [0 0 0],'linewidth', 3)
set(get(AX(2),'Ylabel'),'String','B','Color', [0 0 0],'linewidth', 3)
set(H1,'Color', [0 1 0]);
set(H2,'Color', [1 0 1]);
intervall2 = 4; out2=a:intervall2:b;
set(gca, 'XTick',[out2])
set(gca, 'XTickLabel',Aar(start:intervall2:stop))

Risposte (1)

Karl
Karl il 16 Ott 2013
The folollowing two lines inserted before the two last lines in the script above made it work:
set(AX, 'xTickLabel','')
linkprop(AX,{'Xlim','XTickLabel','Xtick'});

Categorie

Scopri di più su Visual Exploration in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by