필터 지우기
필터 지우기

multicolor bar graph using long vectors

조회 수: 1 (최근 30일)
Dan
Dan 2011년 11월 29일
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

채택된 답변

Walter Roberson
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')

추가 답변 (1개)

Dan
Dan 2011년 11월 29일
Thank you both for the help! Walter your solution worked just fine!
Thanks again!

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by