admin 管理员组文章数量: 887021
2024年2月27日发(作者:xml文件生成)
% to low-resolution, bitmap output.%% Example 1:% bar(rand(3,4));% applyhatch(gcf,'-x.');%% Example 2:% colormap(cool(6));% pie(rand(6,1));% legend('Jan','Feb','Mar','Apr','May','Jun');% applyhatch(gcf,'|-+.',cool(6));%% See also: MAKEHATCH% By Ben Hinkle,
% This code is in the public domain.
oldppmode= get(h,'paperpositionmode');oldunits= get(h,'units');set(h,'paperpositionmode','auto');set(h,'units','pixels');figsize= get(h,'position');if nargin == 2colorlist = [];endbits= hardcopy(h,'-dzbuffer','-r0');set(h,'paperpositionmode',oldppmode);bwidth= size(bits,2);bheight= size(bits,1);bsize= bwidth * bheight;if~isempty(colorlist) colorlist = uint8(255*colorlist); [colors,colori] = nextnonbw(0,colorlist,bits);else colors = (bits(:,:,1) ~= bits(:,:,2)) | ... (bits(:,:,1) ~= bits(:,:,3));endpati= 1;colorind= find(colors);while~isempty(colorind) colorval(1) = bits(colorind(1)); colorval(2) = bits(colorind(1)+bsize); colorval(3) = bits(colorind(1)+2*bsize); if iscell(patterns) pattern = patterns{pati}; elseif isa(patterns,'char') pattern = makehatch(patterns(pati)); else pattern = patterns; end pattern = uint8(255*(1-pattern)); pheight = size(pattern,2); pwidth = size(pattern,1); ratioh = ceil(bheight/pheight); ratiow = ceil(bwidth/pwidth); bigpattern = repmat(pattern,[ratioh ratiow]); if ratioh*pheight > bheight bigpattern(bheight+1:end,:) = []; end if ratiow*pwidth > bwidth bigpattern(:,bwidth+1:end) = []; end bigpattern = repmat(bigpattern,[1 1 3]); color = (bits(:,:,1) == colorval(1)) & ... (bits(:,:,2) == colorval(2)) & ... (bits(:,:,3) == colorval(3)); color = repmat(color,[1 1 3]);
版权声明:本文标题:matlab画图时遇到的一些问题以及解决方法 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.freenas.com.cn/jishu/1708979408h535712.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论