matlab 图案 柱状图_matlab 画不同图案的柱状图

本文介绍了MATLAB函数`applyhatch`用于在柱状图上添加图案的使用方法,包括函数的输入参数和示例代码。通过示例展示了如何用不同图案和颜色替换柱状图的填充色,并提供了`makehatch`辅助函数来创建预定义的图案。
摘要由CSDN通过智能技术生成

function applyhatch(h,patterns,colorlist)

%APPLYHATCH Apply hatched patterns to a figure

% APPLYHATCH(H,PATTERNS) creates a new figure from the figure H by

% replacing distinct colors in H with the black and white

% patterns in PATTERNS. The format for PATTERNS can be

% a string of the characters '/', '\', '|', '-', '+', 'x', '.'

% a cell array of matrices of zeros (white) and ones (black)

%

% APPLYHATCH(H,PATTERNS,COLORS) maps the colors in the n by

% matrix COLORS to PATTERNS. Each row of COLORS specifies an RGB

% color value.

%

% Note this function makes a bitmap image of H and so is limited

% to low-resolution, bitmap output.

%

% Example :

% bar(rand(,));

% applyhatch(gcf,'\-x.');

%

% Example :

% colormap(cool());

% pie(rand(,));

% legend('Jan','Feb','Mar','Apr','May','Jun');

% applyhatch(gcf,'|-+.\/',cool());

%

% See also: MAKEHATCH

% By Ben Hinkle, bhinkle@mathworks.com

% 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 ==

colorlist = [];

end

bits = hardcopy(h,'-dzbuffer','-r0');

set(h,'

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值