multicolor bar graph using long vectors
1 次查看(过去 30 天)
显示 更早的评论
Hello,
I am trying to create a bar graph with one vector of positive numbers and one vector of negative numbers on the same graph. For example:
x = 1:100;
y = -(1:100);
bar(x,'b')
hold on
bar(y,'r')
This works fine!!
The problem is my vectors are 1370 x 1 variables and the same code does not work for long vectors...
x = 1:1370;
y = -(1:1370);
bar(x,'b')
hold on
bar(y,'r')
This creates blue bars for x, but creates black bars for y. Can anyone help me with this problem?!
Thanks, Dan
0 个评论
采纳的回答
Walter Roberson
2011-11-29
"black bars" usually means bars that are so close together that the black edge around them runs together.
Try using
bar(y, 'r', 'Edgecolor', 'none')
0 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Bar Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!