フィルターのクリア

How to make weekdays axis?

3 ビュー (過去 30 日間)
Aleksandra Pawlak
Aleksandra Pawlak 2020 年 11 月 26 日
コメント済み: Aleksandra Pawlak 2020 年 11 月 28 日
Hi,
I want to change dates on the chart to the weekdays (names-monday etc. -not day 1st).
This is my code:
figure(1)
ax1 = axes();
ax1.Box = 'on';
y=[2.2 2.2]
area([0 59],y, 'FaceColor', [0.9 0.9 0.9],'LineStyle','none');
hold on
area([203 347],y, 'FaceColor', [0.9 0.9 0.9],'LineStyle','none');
hold on
area([491 635],y, 'FaceColor', [0.9 0.9 0.9],'LineStyle','none');
hold on
area([779 923],y, 'FaceColor', [0.9 0.9 0.9],'LineStyle','none');
hold on
f=plot(x, THDUmeanL1, x, THDUmeanL2, x, THDUmeanL3)
%legend('04.04.2001','06.04.2001','08.04.2001','10.04.2001')
ax=gca
xticks([1 24:24:1008])
xticklabels({'14:20','18:00','22:00','02:00','06:00','10:00','14:00','18:00','22:00','02:00','06:00','10:00','14:00','18:00','22:00','02:00','06:00','10:00','14:00','18:00','22:00','02:00','06:00','10:00','14:00','18:00','22:00','02:00','06:00','10:00','14:00','18:00','22:00','02:00','06:00','10:00','14:00','18:00','22:00','02:00','06:00','10:00','14:00'})
xtickangle(-60)
xlim([1,1008])
ylim([0,2.2])
ax2 = axes();
hold(ax2);
ax2.Position = ax1.Position;
ax2.Color = 'none';
ax2.XAxisLocation = 'top';
ax2.YAxis.Visible = 'off';
plot(NaT, NaN); % to make x-axis datetime
ax2.XLim = [datetime(2001, 3, 28) datetime(2001, 4, 4)]+hours(8);
ax2.XTick = [ax2.XLim(1) ax2.XTick];
drawnow;
ax2.XAxis.TickLabelFormat = 'MMM dd';

採用された回答

Walter Roberson
Walter Roberson 2020 年 11 月 27 日
ax2.XAxis.TickLabelFormat = 'eee'; %or 'eeee'
  1 件のコメント
Aleksandra Pawlak
Aleksandra Pawlak 2020 年 11 月 28 日
Thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLanguage Fundamentals についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by