How do I pass bar colors to multiple bar series in @bar function?

3 ビュー (過去 30 日間)
Irina
Irina 2018 年 9 月 13 日
I'm trying to plot a line and bar chart on the same graph. On the Left axis I have 2 line plots of series in matrix Y1, on the Right axis a grouped bar of 2 series in Y2. Is there a way to pass bar colors to the 2 series inside the @bar function? Here's the code example:
x1 = [datenum(2010, 1, 1):datenum(2018, 1, 1)]';
Y1 = [log(x1 - x1(1) + 1), 0.5 + log(x1 - x1(1) + 1)];
x2 = datenum(2010:2018, 1, 1)';
Y2 = normrnd(0, 1, 9, 2);
figure
hAx = plotyy(x1, Y1, x2, Y2, @plot, @bar);
hAx(1).XLim = [datenum('1jan10'), datenum('1jan19')];
hAx(1).XTick = [datenum('1jan10'):365:datenum('1jan19')];
hAx(2).XLim = [datenum('1jan10'), datenum('1jan19')];
hAx(2).XTick = [datenum('1jan10'):365:datenum('1jan19')];
datetick('x', 'yy');

回答 (0 件)

カテゴリ

Help Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by