plotyy issue with 'bar' graph, not scaling correctly?

1 回表示 (過去 30 日間)
Chris E.
Chris E. 2015 年 8 月 24 日
編集済み: Chris E. 2015 年 8 月 26 日
Hello all! When I plot the data using plotyy making a bar graph with two sets of data, MATLAB plots it, but there is a distinct 2 sets of bars that can be seen (within the same binning). If you look at the example plot code given below, when I run this code, it plots the bar plot with two different bar values in order to keep the y-tick label consistent on both sides. I would like MATLAB to always keep the bar consistent, even if it means the ticks have to be different on both sides, I do not know how to do that, Please help! Here is the code:
rest = [330;
0;
3187;
0;
0;
0;
0;
0;
0;
0;
0;
17;
0];
rest_percent = [0.0934;
0;
0.9018;
0;
0;
0;
0;
0;
0;
0;
0;
0.0048;
0];
plotyy(1:13,rest_percent,1:13,rest,'bar','bar');
  2 件のコメント
Walter Roberson
Walter Roberson 2015 年 8 月 24 日
In R2014a I only see one set of bars per bin.
Chris E.
Chris E. 2015 年 8 月 25 日
I did wonder if it is a version issue.... I'm going to look into it! Thanks.

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

採用された回答

Morteza
Morteza 2015 年 8 月 25 日
編集済み: Morteza 2015 年 8 月 25 日
I plot your data and it become like bellow:
but with change in some parts of plot item...
  2 件のコメント
Chris E.
Chris E. 2015 年 8 月 25 日
I don't get what you got, mine is all blue bars and black lines. However it looks like yours is doing what mine does, but with color. I want both bars to be exactly even with one another, not having any part that is higher or lower.
Chris E.
Chris E. 2015 年 8 月 25 日
You said, "but with change in some parts of plot item..." Could you show me your code to do that plot (assuming there is something different)? Thanks!

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

その他の回答 (1 件)

Chris E.
Chris E. 2015 年 8 月 25 日
I'm attaching a pic to my question:
This is what I get exactly from my code, look at the blue bars, there is actually two of them. Any way to make them line up is what I would like. Thank you!

カテゴリ

Help Center および File ExchangeTwo y-axis についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by