完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
hatchfill
Neil's function allows you to pass in patch handles and convert them into hatches that are customizable. Let's look at this contour plot which contains several sections that I want to replace with hatches. 尼尔的函数让你能够修补处理斑点,把它们(斑点)转化成自定义的影线。 让我们看看下面这个轮廓图,它包含有几个我想要用影线来代替的部分, % Create two data sets mData = membrane(1, 50); pData = peaks(101)-10; % Set colormap colormap([0 0 0; summer; 1 1 1]) contourf(mData); caxis([min(mData(:)), max(mData(:))]); hold on [c1, h1] = contourf(pData, [2.5 2.5]-10); [c2, h2] = contourf(-pData, [2.5 2.5]+10); hold off; 下面是处理斑点图案形成影线的图案 % Get patch objects from CONTOURGROUP hPatch1 = findobj(h1, 'Type', 'patch'); hPatch2 = findobj(h2, 'Type', 'patch'); % Apply Hatch Fill hh1 = hatchfill(hPatch1, 'single', -45, 3); hh2 = hatchfill(hPatch2, 'cross', 45, 3); % Remove outline set([h1, h2], 'LineStyle', 'none') % Change the cross hatch to white set(hh2, 'Color', 'white') I can make one diagonal hatch and other across the hatch 我形成了一种斜纹的影线图案以及其他的图案是交叉的影线。 如图: . applyhatch_pluscolor and applyhatch_plusC Both Brandon's and Brian's entries convert the distinct colors in the whole figure into hatch patterns. The nice thing about this is that they will also take care of legends. Brandon和Brian的函数都能把图中颜色清晰的条目转换成影线的形式, 令人高兴的是,他们也考虑到了插图的说明,即图案注释中的条目也能够转换成影线形式,和转换后的图案保持一致,不用额外来修改注释。 % Create original plot fH = gcf; colormap(jet(4)); h = bar(rand(3, 4)); legend('Apple', 'Orange', 'Banana', 'Melon', 'Location', 'EastOutside'); % Apply Brandon's function tH = title('Brandon''s applyhatch'); applyhatch_pluscolor(fH, '-x.', 0, [1 0 1 0], jet(4)); % Apply Brian's function set(tH, 'String', 'Brian''s applyhatch'); applyhatch_plusC(fH, '-x.', 'rkbk'); set(tH, 'String', 'Original'); Both of these functions were derived and inspired by some of the same existing entries, so the functionalities are quite similar, with some differences in syntax. For example, Brandon's function has a couple of convenience syntaxes for inverting foreground/background colors and specifying different hatch line width. Brian's function can assign arbitrary mix of colors to the hatches regardless of the original colors used. 上面这些函数都是通过一些类似的函数修改而来的,所以这些函数都十分的相似,仅仅在语法上有一些不同。例如Brandon的函数就包含一些方便的语句来突出前景和背景的颜色以及用来指定不同影线的宽度; Brian的函数在于,无论原来使用的颜色是什么,它能够给影线指定任意的颜色。 以上来自http://blogs.mathworks.com,原文是全英文,这里加上个人的理解加以翻译,若有不妥之处,请批评指正 |
|
相关推荐
|
|
使用simulink进行三相短路故障分析时,各参数应该如何设置
1230 浏览 1 评论
想请教一下图中是simulink的什么模块,需要这种三段斜率函数模块但没找到在哪
1372 浏览 1 评论
2290 浏览 1 评论
200圆!求助大佬给一份VSG并网和离网模式的simulink仿真
2551 浏览 0 评论
MATLAB(3)--矩阵的引用(sub2ind、ind2sub、reshape函数使用)
3381 浏览 0 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-18 10:19 , Processed in 0.648595 second(s), Total 70, Slave 52 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号