필터 지우기
필터 지우기

why facecolor 'Flat' in bar and area is different and how to make them the same

조회 수: 14 (최근 30일)
I am using area and bar to plot a figure. I have used the color 'Flat' both for the two. However, the two legend colors are not the same. I am so confused why 'Flat' can generate two different color system. And how to make the 'Flat' in 'bar' operation the same to the one in 'area'?
figure;
area([1:12;2:13],'FaceColor','flat')
figure;
hBar=bar([1:12;2:13],subcap,0.5,'stacked','FaceColor','flat');

답변 (1개)

Walter Roberson
Walter Roberson 2018년 6월 18일
편집: Walter Roberson 2018년 6월 18일
When you do not pass CData information to bar(), then it fills in the colors using the axes ColorOrder property.
area() on the other hand by default is affected by the current colormap.
  댓글 수: 2
Chaoyang Jiang
Chaoyang Jiang 2018년 6월 18일
Thank you for your answer. Then may I know how to get the rgb of flat color, so that I can manually change the color in bar through CData?
Walter Roberson
Walter Roberson 2018년 6월 18일
'flat' does not define a color itself: it defines how colors are to be interpolated between the different vertices.
I need to do more research to figure out what values are used to determine the color.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by