# How to plot multiple Xaxis Label| Unit in Hour and Time of the day? Both XLabel at the bottom

2 vues (au cours des 30 derniers jours)
balandong le 12 Juil 2017
Modifié(e) : balandong le 12 Juil 2017
Hi Coder, May I know how to plot double Xaxis Label. In addition, both the Xlabel will be at the bottom and tick should be align, atleast. I know there are several example in the net. However, I fail to reproduce it according to my requirement. I really appreciate for any hint.
Yaxis = rand(1,8); %4 reading per day at 0930,1300, 1500, 1800
Xaxis_TimeHour = [9 13 15 18 33 37 39 42];
% If time start from zero, the reading in two will be at 9,13,15,18,33,37,39,42
Xaxis_TimeofDay = [0900 1300 1500 1800 0900 1300 1500 1800];
figure;
scatter (Xaxis_TimeHour ,Yaxis);
xlim([0 48])
ylim([0 1])
tick = 0:4:48;
set(gca, 'XTick', tick)
set(gca, 'XTickLabel', arrayfun(@num2str, tick, 'UniformOutput', false))
set(gca, 'XMinorTick', 'off')
set(gca, 'TickDir', 'out')
set(b,'Color','none');
a=axes('Position',[.1 .2 .8 .7]); % I dont now how to efficiently positioned the sub-Xaxis Label~
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Réponses (1)

dbmn le 12 Juil 2017
You could do something like this:
ax1 = gca;
ax2 = axes('Position',ax1.Position,...
'XAxisLocation','top',...
'YAxisLocation','right',...
'Color','none');
##### 1 commentaireAfficher -1 commentaires plus anciensMasquer -1 commentaires plus anciens
balandong le 12 Juil 2017
Hi Dbmn, Thanks for your suggestion. But, what I need is both XAxis label at the bottom. Appreaciate the time taken entertaining this problem.

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Labels and Annotations dans Help Center et File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by