国赛就是明天了,写了个很有意思的东西,虽然目前只是个雏形但是,这玩意真的挺有意思的,很多人写完基础代码绘图后不咋修饰就点开属性编辑器一顿点点点,但这样画出的图毕竟只有图没有相关代码,有没有啥办法能够把点点点的过程转化为代码,能把论文写的更长一点?于是就有了下面这个小工具,首先介绍用法,最后给出工具函数完整代码(初代懒得写注释ing):
基本使用写完绘图函数后在代码最后加入一行codeprinter
t=0.01:0.2:3*pi;
hold on
plot(t,cos(t)./(1+t),'LineWidth',2)
plot(t,sin(t)./(1+t),'LineWidth',2)
plot(t,cos(t+pi/2)./(1+t+pi/2),'LineWidth',2)
plot(t,cos(t+pi)./(1+t+pi),'LineWidth',2)
legend
codeprinter
点击:查看->属性编辑器
进行一通编辑:
关闭窗口后就能自动在命令行窗口生成一系列代码:
删掉代码末尾的codeprinter
,把命令行的代码加载最后,能获取之前全部修饰效果,美滋滋:
t=0.01:0.2:3*pi;
hold on
plot(t,cos(t)./(1+t),'LineWidth',2)
plot(t,sin(t)./(1+t),'LineWidth',2)
plot(t,cos(t+pi/2)./(1+t+pi/2),'LineWidth',2)
plot(t,cos(t+pi)./(1+t+pi),'LineWidth',2)
legend
fig=gcf;
fig.Children(1).FontName='Cambria';
fig.Children(1).FontSize=11;
fig.Children(1).LineWidth=2;
fig.Children(1).Location='southeast';
fig.Children(1).NumColumns=4;
fig.Children(1).Orientation='horizontal';
fig.Children(1).Position=[0.4103, 0.12433, 0.48022, 0.028419];
fig.Children(1).Title.FontName='Cambria';
fig.Children(1).Title.FontSize=11;
fig.Children(2).XColor=[1, 0, 0];
fig.Children(2).XTick=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
fig.Children(2).XTickLabel={'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'};
fig.Children(2).YColor=[1, 0, 0];
fig.Children(2).ZColor=[1, 0, 0];
fig.Children(2).LineWidth=2;
fig.Children(2).XGrid='on';
fig.Children(2).YGrid='on';
fig.Children(2).Box='on';
fig.Children(2).Title.Position=[5, 1.0061, -1.4211e-14];
fig.Children(2).Title.String='demo of codeprinter';
fig.Children(2).Title.FontName='Cambria';
fig.Children(2).Title.FontSize=16;
fig.Children(2).Subtitle.Position=[5, 1.0042, -1.4211e-14];
fig.Children(2).XLabel.Color=[1, 0, 0];
fig.Children(2).XLabel.Position=[5, -0.4549, -1];
fig.Children(2).YLabel.Color=[1, 0, 0];
fig.Children(2).YLabel.Position=[-0.58126, 0.3, -1];
fig.Children(2).ZLabel.Color=[1, 0, 0];
fig.Children(2).Children(4).LineWidth=4;
fig.Children(2).Children(4).Marker='
关注
打赏
最近更新
- 深拷贝和浅拷贝的区别(重点)
- 【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脚手架写一个简单的页面?