matlab中画有阴影的柱状图

matlab中画有阴影的柱状图

ID:12836743

大小:94.00 KB

页数:15页

时间:2018-07-19

matlab中画有阴影的柱状图_第1页
matlab中画有阴影的柱状图_第2页
matlab中画有阴影的柱状图_第3页
matlab中画有阴影的柱状图_第4页
matlab中画有阴影的柱状图_第5页
资源描述:

《matlab中画有阴影的柱状图》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、在画柱状图时,利用不同的颜色区分在实际打印时经常区分不出。为了能够更清楚第表示最终结果,可采用在柱状图中打阴影的方式来表示。然而,Matalab本身没有提供实现这种功能的函数库。下面两个函数:%ApplyBrandon'sfunctionapplyhatch_pluscolor%ApplyBrian'sfunctionapplyhatch_plusC(fH,'-x.','rkbk');实现了上述功能。这两个函数中都调用了函数makehatch_plus源码如下(都已经调试通过,可方便使用)。fH=gcf;colormap(jet(4));h=bar(

2、rand(3,4));legend('Apple','Orange','Banana','Melon','Location','EastOutside');%ApplyBrandon'sfunctiontH=title('Brandon''sapplyhatch');applyhatch_pluscolor(fH,'-x.',0,[1010],jet(4));%ApplyBrian'sfunctionset(tH,'String','Brian''sapplyhatch');applyhatch_plusC(fH,'-x.','rkbk');set

3、(tH,'String','Original');代码源自:http://www.mathworks.com/matlabcentral/fileexchange/24021-hatch-fill-patterns-plus-color-invert/content/applyhatch_pluscolor.mfunction[im_hatch,colorlist]=applyhatch_pluscolor(h,patterns,CvBW,Hinvert,colorlist,...dpi,hatchsc,lw)%APPLYHATCH_PLUSCOLOR

4、ApplyhatchedpatternstoafigureinBWorColor%APPLYHATCH_PLUSCOLOR(H,PATTERNS)createsanewfigurefromthefigureHby%replacingdistinctcolorsinHwiththeblackandwhite%patternsinPATTERNS.TheformatforPATTERNScanbe%astringofthecharacters:%'/','','

5、','-','+','x','.','c','w','k'%(seemakehatch_pl

6、us.mformoredetails)or%acellarrayofmatricesofzeros(white)andones(black)%%Inaddition,Hcanalternativelybeauint8NxMx3matrixofthetype%producedbyimread.Inthiscase,colorsinthisimagewillbe%replacedwithpatternsasifitwasafigure.Afinalfigurewindow%willbegeneratedthatdisplaystheresult.TheDP

7、Iargument%discussedbelowwillbeignoredifHisanimagematrix.%%APPLYHATCH_PLUSCOLOR(H,PATTERNS,CVBW)binaryvalueforchoiceofColororBlack%andWhiteplots.Ifcolorischosenthecolorwillmatchthatofthe%currentfill.1->Color,anythingelse->BW%%APPLYHATCH_PLUSCOLOR(H,PATTERNS,CVBW,HINVERT)binaryval

8、uetoinvertthehatch.%i.e.,ifitisblacklineswithawhitebackground,thatbecomeswhite%lineswithablackbackground.Thiscaneitherbeascalarvalueora%1xNarrayequaltothelengthofPATTERNS.Whenusedasanarrayeach%PATTERNS(i)willbeinvertedaccordingtoHinvert(i).1->Invert,%anythingelse->NonInverted%%A

9、PPLYHATCH_PLUSCOLOR(H,PATTERNS,CVBW,HINVERT,COL

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。