Legend patch color changes when hgexport
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi I have manually changed patch colors in the legend to suit my preferences, but when I run hgexport at the end to export the file into .eps, the colors switch back. I am using a function called 'plotBarStackGroups'
plotBarStackGroups(d(:,:,1:15),{1:6}) %Function for plotting grouped and stack bar charts (3-d dataset
lg=legend('a','b','c','location','northwest'); % Create legend
lgp=findobj(lg,'type','patch'); %Find the legend patches (only 3)
cm=[0 1 0; 0 0.8 1; 0 0 1]; % define Colors
set(lgp(1),'facecolor',cm(1,:)); %Manually change the patch colors
set(lgp(2),'facecolor',cm(2,:));
set(lgp(3),'facecolor',cm(3,:));
hgexport(gcf,'fig.eps') % Export figure into .eps
To be noted, is that the switch back also occurred previously, when I had used the command:
set(gca,'fontsize',11)
To resolve this I moved this command above the color switch, but obviously cannot do this with the export function! Many thanks
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Legend에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!