MATLAB绘制纹理柱状图

https://ww2.mathworks.cn/matlabcentral/fileexchange/24021-hatch-fill-patterns-plus-color-invert

需要下载matlab包

MATLAB绘制纹理柱状图

applyhatch_pluscolor.m 是用来绘制的

makehatch_plus.m 当中包含了填充纹理的样式

testforapplyhatch.m 是用来测试两个文件的

h = bar(rand(3,8));
fH = gcf;
colormap(cool(8));
legend('Apple', 'Orange', 'Banana','Melon','1','2','3');
tH = title('Brandon''s applyhatch');
% '/', '\', '|', '-', '+', 'x', '.', 'c', 'w', 'k'
applyhatch_pluscolor(fH, '.++\/x|w', 0, [0 1 0 0 0 0 0 0], cool(8));

 

% '/', '\', '|', '-', '+', 'x', '.', 'c', 'w', 'k' 代表纹理填充的样式 ‘k’代表black, 'w'代表white

 

[0 1 0 0 0 0 0 0]  当中1代表填充为黑色

[0 1 0 0 0 0 0 0]前面的标志位,0代表黑白,1代表彩色

MATLAB绘制纹理柱状图

注:经检测 matlab 2015b, 2016b可正常使用,warning可忽略,其余版本未进行尝试