Bug with Legend object shading being reset during print

조회 수: 1 (최근 30일)
Curtis
Curtis 2016년 7월 25일
편집: Adam Danz 2021년 5월 16일
This produces a legend with an interpolated icon to better identify the surface, trivial here, but critical with many surfaces you want to print for publication.
figure(2); clf; Z=peaks; surf(Z); hold on; set(gcf,'PaperPositionMode','auto');
patch([-1; 1; 1; -1;]*25+25, [-1; -1; 1; 1;]*25+25,[1; 1; 1; 1;]+4,'EdgeColor','k','EdgeAlpha',0.6,'FaceAlpha',0.4,'LineStyle','--','FaceColor',[1 0 0])
set(gcf,'Position',[ 13 46 1249 556]); set(gcf,'Color',[1 1 1]);
[h,h_icons]=legend([{'peaks'},{'baseline'}]);
set(h_icons(3),'CData',[2 -10 2 10],'FaceColor','interp');
print(gcf,'-dpng',[cd '\BAD_flat_legend'],'-r300');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
what it's supposed to look like
What actually prints
  댓글 수: 3
Div Tiwari
Div Tiwari 2016년 8월 8일
I was unable to reproduce this in MATLAB R2016a with any of the graphics renderers. Could you tell me which release of MATLAB you're using?
Curtis
Curtis 2016년 8월 22일
2015a
  1. Were you able to get any output from the code?
  2. If you got the plot did you get interpolated color in the legend?

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

답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by