How to plot 2 different colour using RBG setting
조회 수: 1 (최근 30일)
이전 댓글 표시
plot(x,y,'color',[0,0.5,0], x,y2, 'color',[0.5,0,0])
It said
Error using plot
Vectors must be the same length.
If I am using:
plot(x,y,'color',[0,0.5,0]),
it works.
댓글 수: 0
답변 (1개)
Image Analyst
2020년 1월 3일
Your y2 does not have the same number of elements as x. It has nothing to do with the colour.
댓글 수: 3
Image Analyst
2020년 1월 3일
Yeah, weird - I don't know. However you can do it as two separate calls to plot with hold on in between:
x = 1 : 20;
y = rand(1, length(x));
y2 = rand(1, length(x));
plot(x,y, 'color', [0,0.5,0]);
hold on
plot(x,y2, 'color', [0.5,0,0])
참고 항목
카테고리
Help Center 및 File Exchange에서 Orange에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!