フィルターのクリア

Color-interpolated patch legend is in full color instad of being interpolated

3 ビュー (過去 30 日間)
liomsi liomsi
liomsi liomsi 2019 年 3 月 22 日
コメント済み: liomsi liomsi 2019 年 3 月 27 日
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:
But the legend of the patch is full gray color:
Screen Shot 2019-03-22 at 13.38.27.png
Thank you for your help
  3 件のコメント
liomsi liomsi
liomsi liomsi 2019 年 3 月 22 日
I added an image (modified manually by adding a color bar over the legend) so that you can understand why I would like the gradient-color in legend.
Thanks
Jan
Jan 2019 年 3 月 25 日
Yes, this is clear know. Thanks for the clarification.

サインインしてコメントする。

回答 (1 件)

Jan
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.
  1 件のコメント
liomsi liomsi
liomsi liomsi 2019 年 3 月 27 日
Thank you Jan.
So I understand there is no "normal" way to do it. It is disapointing that the legend color of a gradient patch cannot be a color gradient.
Your hacked solution seems quite complex to achieve what i want within a reasonable time, so I will do it by "photoshoping" it.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangePolygons についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by