没想到叭,阴影柱状图仅仅一天就迎来了(1.5.1)版本,已经支持水平柱状图绘制!!同时本人又连夜赶制了另外两款相关的阴影图绘制函数:
来来来,后文马上介绍一下这三款函数。
另:代码开发基于polyshape
对象,阴影柱状图绘制函数理论上需要至少R2017b
及之后版本才能使用(越新越好)。(polyshape yyds)
先讲解此函数如何使用,再在此部分最后给出完整代码:
基本使用设置为角度为pi/3,80根线条进行填充:
t=0:.01:2*pi;
X=cos(t);
Y=sin(t);
plot(X,Y,'LineWidth',2);
hold on;axis equal
shadowFill(X,Y,pi/3,80);
t=0:.01:2*pi;
y=sin(t);
plot(t,y,'LineWidth',2);
hold on;axis equal
shadowFill(t,y,pi/4,80);
这个就比较复杂了,给个例子:
t=-.1:.01:pi/2;
y1=sin(t).*2;
y2=t.^2;
hold on
plot(t,y1,'LineWidth',2);
plot(t,y2,'LineWidth',2);
diffy=y1-y2;
tpos=find(diffy>=0);
T=[t(tpos(1):tpos(end)),t(tpos(end):-1:tpos(1))];
Y=[y1(tpos(1):tpos(end)),y2(tpos(end):-1:tpos(1))];
shadowFill(T,Y,pi/5,70);
t=-.1:.01:pi/2;
y1=sin(t).*2;
y2=t.^2;
hold on
plot(t,y1,'LineWidth',2);
plot(t,y2,'LineWidth',2);
diffy=y1-y2;
tpos=find(diffy>=0);
T=[t(tpos(1):tpos(end)),t(tpos(end):-1:tpos(1))];
Y=[y1(tpos(1):tpos(end)),y2(tpos(end):-1:tpos(1))];
shadowFill(T,Y,pi/5,70,'LineStyle',':','Color',[.2,.2,.9]);
function SF=shadowFill(X,Y,theta,num,varargin)
% @author : slandarer
% gzh : slandarer随笔
if theta>pi/2||theta=max(tY))=[];tYY(tYY=max(tY))=[];tYY(tYY=max(tY))=[];tYY(tYY=max(tY))=[];tYY(tYY
关注
打赏
最近更新
- 深拷贝和浅拷贝的区别(重点)
- 【Vue】走进Vue框架世界
- 【云服务器】项目部署—搭建网站—vue电商后台管理系统
- 【React介绍】 一文带你深入React
- 【React】React组件实例的三大属性之state,props,refs(你学废了吗)
- 【脚手架VueCLI】从零开始,创建一个VUE项目
- 【React】深入理解React组件生命周期----图文详解(含代码)
- 【React】DOM的Diffing算法是什么?以及DOM中key的作用----经典面试题
- 【React】1_使用React脚手架创建项目步骤--------详解(含项目结构说明)
- 【React】2_如何使用react脚手架写一个简单的页面?