资源简介
matlab 绘制 阴影 黑白 柱状图 条形图, 本来想免费发布,但csdn必须设置资源分数,如果需要请私信我。
代码片段和文件信息
function applyhatch(hpatternscolorlist)
%APPLYHATCH Apply hatched patterns to a figure
% APPLYHATCH(HPATTERNS) 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(HPATTERNSCOLORS) maps the colors in the n by 3
% 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 1:
% bar(rand(34));
% applyhatch(gcf‘\-x.‘);
%
% Example 2:
% colormap(cool(6));
% pie(rand(61));
% 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 == 2
colorlist = [];
end
bits = hardcopy(h‘-dzbuffer‘‘-r0‘);
set(h‘paperpositionmode‘oldppmode);
bwidth = size(bits2);
bheight = size(bits1);
bsize = bwidth * bheight;
if ~isempty(colorlist)
colorlist = uint8(255*colorlist);
[colorscolori] = nextnonbw(0colorlistbits);
else
colors = (bits(::1) ~= bits(::2)) | ...
(bits(::1) ~= bits(::3));
end
pati = 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(pattern2);
pwidth = size(pattern1);
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]);
bits(color) = bigpattern(color);
if ~isempty(colorlist)
[colorscolori] = nextnonbw(coloricolorlistbits);
else
colors = (bits(::1) ~= bits(::2)) | ...
(bits(::1) ~= bits(::3));
end
colorind = find(colors);
pati = (pati + 1);
if pati > length(patterns)
pati = 1;
end
end
newfig = figure(‘units‘‘pixels‘‘visible‘‘off‘);
imaxes = axes(‘parent‘newfig‘units‘‘pixels‘);
im = image(bits‘parent‘imaxes);
fpos = get(newfig‘position‘);
set(newfig‘posit属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3563 2018-04-18 21:32 figure\applyhatch.m
文件 796 2018-04-21 12:18 figure\main_top.m
文件 954 2018-04-18 21:34 figure\makehatch.m
目录 0 2018-04-21 12:18 figure\
- 上一篇:10用户CDMA matlab实现
- 下一篇:matlab NS 单车道
相关资源
- 串行级联cpm系统MATLAB仿真
- matlab_OFDM调制解调(来自剑桥大学)
- Matlab路面裂缝识别69319
- 高灵敏度GPS接收机MATLAB仿真,附捕获
- 基于MATLAB的质点弹道计算与外弹道优
- 阵列天线的matlab仿真
- MATLAB 经典程序源代码大全
- MATLAB小波软阈值去噪代码33473
- 天线阵的波束形成在MATLAB仿真程序及
- 非线性SVM算法-matlab实现
- 《MATLAB 智能算法超级学习手册》-程序
- 组合导航matlab程序
- 读取txt文件内容matlab代码实现
- Matlab实现基于相关的模板匹配程序
- matlab优化工具箱讲解
- 基于MATLAB的快速傅里叶变换
- 光纤传输中的分布傅立叶算法matlab实
- 基于matlab的图像处理源程序
- matlab 椭圆拟合程序
- 算术编码解码matlab源代码
- optical_flow 光流法 matlab 实现程序
- 引导图像滤波器 Matlab实现
- 分形几何中一些经典图形的Matlab画法
- OFDM系统MATLAB仿真代码
- SVM工具箱(matlab中运行)
- 图像小波变换MatLab源代码
- LU分解的MATLAB实现
- 冈萨雷斯数字图像处理matlab版(第三
- 替代数据法的matlab程序
- 用matlab实现的多站定位系统性能仿真
川公网安备 51152502000135号
评论
共有 条评论