Color-interpolated patch legend is in full color instad of being interpolated
3 次查看(过去 30 天)
显示 更早的评论
Hello,
I have a patch with a gradient color. Is there a way that this gradient color could be displayed in the figure legend (I don't want a color bar)?
Below is the code to reproduce the issue. I am on Matlab R2017a under mac os.
figure
patch([0 1 1 0],[0 0 1 1],[0 1 1 0],'FaceColor','interp')
legend('Why no interpolated colors here?')
I would like something which looks like this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/209808/image.png)
But the legend of the patch is full gray color:
![Screen Shot 2019-03-22 at 13.38.27.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/209809/Screen%20Shot%202019-03-22%20at%2013.38.27.png)
Thank you for your help
3 个评论
回答(1 个)
Jan
2019-3-25
The legend command is (one of) the most frequently modified function(s) of Matlab's toolboxes. You can access the contents of the legend by some undocumented methods, see https://undocumentedmatlab.com/blog/plot-legend-customization, but this has a certain leven of fragility, such that it will work with the current Matlab version only.
Please try, if one of the methods shown in this link can solve the problem.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polygons 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!