why facecolor 'Flat' in bar and area is different and how to make them the same
13 次查看(过去 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');
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/191328/image.jpeg)
0 个评论
回答(1 个)
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 个评论
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 Center 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!