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!