2017-11-24 5 views
1

どのように私はdatetime値でグループ化された棒グラフのためにx軸をカスタマイズすることができます:MM:SSMatlab - グループ化された棒グラフでdatetime値を使ってxaxisをカスタマイズするにはどうすればよいですか?

私は私のy値と形式DD-MM-YYYYのHHで150x1 datetimevaluesのベクトルとして150x3 MATRICEを持っています。それぞれのバーのグループには、図に示すように、x軸上のdatetime値が1つラベルされています。enter image description here

ありがとうございます!ここで

答えて

0
clc; clear all; close all; 
figure; 
y = [1 3 5; 3 2 7; 3 4 2]; 
b = bar(y,'FaceColor','flat'); 
d1 = '23-Aug-2010 16:35:42'; 
t1 = datetime(d1,'InputFormat','dd-MMM-yyyy HH:mm:ss'); 
d2 = '24-Aug-2010 16:35:42'; 
t2 = datetime(d2,'InputFormat','dd-MMM-yyyy HH:mm:ss'); 
d3 = '25-Aug-2010 16:35:42'; 
t3 = datetime(d3,'InputFormat','dd-MMM-yyyy HH:mm:ss'); 
x = [1 2 3]; 
str = {datestr(t1); datestr(t2); datestr(t3)}; 
set(gca, 'XTickLabel',str, 'XTick',1:numel(str)); 
xtickangle(45); 

enter image description here

+0

あなたの答えをありがとう – emil7

0

は一例です:

figure; 
    y = [1 3 5; 3 2 7; 3 4 2]; 
    b = bar(y,'FaceColor','flat'); 
    x = [1 2 3]; 
    str = {'alpha'; 'beta'; 'gamma'}; 
    set(gca, 'XTickLabel',str, 'XTick',1:numel(str)) 

enter image description here

+0

あなたの答えのためのあなたのナッシュありがとうございました。私の質問のように、xaxisのdatetime値のベクトルの例を教えてください。事前にありがとう – emil7

+0

ここにコメント内のコードを書式設定するのは難しいので、別の回答を参照してください。 –

関連する問題