matlab柱状斜线_matlab画柱状图,能否达到附件的效果。

这篇博客介绍了如何在MATLAB中创建带有斜线图案的柱状图。作者提供了主程序代码以及applyhatch函数,该函数能够将柱状图的颜色替换为斜线图案,支持多种预定义的图案。文章还包含了一个用于生成图案的makehatch辅助函数。读者可以通过提供的代码实现类似附件所示的柱状图效果。
摘要由CSDN通过智能技术生成

本帖最后由 meatball1982 于 2012-5-9 19:05 编辑

b45c2f73d32ef42a2e4a403a0efc5a3a.png

bar.jpg (58.86 KB, 下载次数: 33)

2012-5-9 19:04 上传

baidu的。

主程序。

暂定好用。

颜色的可以自己定义,matlab就有。

斜线和X在applyhatch里有。

data = [96.3,92.6,71.2;95.7,93.6,83.9;96.8,94.3,78.3;95.8,92.7,80.3]

bar(data,1)

axis([0 6 0.0 100])

legend('方法','exited','Square')

set(gca,'XTickLabel',{'Img1','Img2','Img3','Img4'})

applyhatch(gcf,'\.x.')

applyhatch函数:

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 3

%  matrix COLORS to PATTERNS. Each row of COLORS spe

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值