how add Month label in x axis

18 ビュー (過去 30 日間)
Afsher P A
Afsher P A 2020 年 7 月 23 日
コメント済み: Just_me 2020 年 7 月 23 日
set(gca, 'xtick' , 1 : 12,...
'xticklabel', {'apr19', 'may19', 'june19', 'july19', 'aug19', 'sept19', 'oct19', 'nov19', 'dec19', 'jan20', 'feb20', 'mar20'})
xticklabel(Month)
kWh = [123 139 109 89 90 96 145 167 149 123 140 180];
CUF = [17.08 18.68 15.14 11.96 12.09 13.33 19.48 23.19 20.03 16.53 19.44 24.19];
yyaxis left
p = plot(month,CUF);
yyaxis right
b = bar(month,kWh);
xlabel('Month & year')
yyaxis left
ylabel('CUF')
yyaxis right
ylabel('kWh')
p.LineWidth = 3;
b.FaceColor = [ 0 0.447 0.741];

採用された回答

Serhii Tetora
Serhii Tetora 2020 年 7 月 23 日
編集済み: Serhii Tetora 2020 年 7 月 23 日
clear; close all; clc
month = {'apr19', 'may19', 'june19', 'july19', 'aug19', 'sept19', 'oct19', 'nov19', 'dec19', 'jan20', 'feb20', 'mar20'};
kWh = [123 139 109 89 90 96 145 167 149 123 140 180];
CUF = [17.08 18.68 15.14 11.96 12.09 13.33 19.48 23.19 20.03 16.53 19.44 24.19];
yyaxis left
p = plot(CUF);
yyaxis right
b = bar(kWh);
set(gca, 'xticklabel', month )
xlabel('Month & year')
yyaxis left
ylabel('CUF')
yyaxis right
ylabel('kWh')
p.LineWidth = 3;
b.FaceColor = [ 0 0.447 0.741];
  3 件のコメント
Serhii Tetora
Serhii Tetora 2020 年 7 月 23 日
just delete last line
Just_me
Just_me 2020 年 7 月 23 日
t1 =datetime(2019,4,1) + calmonths(1:12) %t
Sig=[0 1 2 3 4 5 6 4 3 2 1 0];
figure(1)
plot(t1(1:12),Sig,'r*-')
xlabel('Month-year')
ylabel('ua')

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGrid Lines, Tick Values, and Labels についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by