Origin快速格式化Graph

       在Origin中,每做一副图后,你是否都要设置Graph中每一个对象的属性?特别在处理大量类似图片时(如,毕业论文中的大量数据图),是不是觉得图片设置和图片在Word中的设置都让你头痛。现在,本人将Origin中快速设置图片属性的方法总结如下。与此同时,你可以结合自己的需要,对下面每个参数进行修改。

例 子:

1、启动Origin。 (以Origin8.5为例)

2、Alt+3,打开Command window (字母键上的3,有#号的)

3、在Command window中输入:col(1)=data(-10,10,0.01)

4、在Command window中输入:col(2)=sin(col(1))

5、在Command window中输入:plotxy iy:=(col(1),col(2)) plot:=200

6、打开:Code bulder 编辑器,并新建一个LabTalk文件(如test.ogs)。(方法见“LabTalk 编程第一章---如何运行LabTalk脚本”)

7、将下面红色代码复制到test.ogs中。

8、选中全部代码(不要用Ctrl+A)

9、点击“!”运行。将弹出如下对话框:

                                                              

你将获得如下图像:




代码如下:


[MAIN]

@Global=0;
//==================================
double xfrom=-5,xto=5,xinc=2;
double yfrom=-1,yto=1,yinc=1;
string pagename$="test",xb_name$="XX",yl_name$="YY";
GetN
(X  From) xfrom
(X    To) xto
(X   inc) xinc
(Y  From) yfrom
(Y    To) yto
(Y   inc) yinc
(P  name) pagename$
(Xb_name) xb_name$
(Yl_name) yl_name$
(Format Image Dialog);
run.section(,Line);
run.section(,X1_axis,$(xfrom) $(xto) $(xinc));
run.section(,Y1_axis,$(yfrom) $(yto) $(yinc));
run.section(,X2_axis);
run.section(,Y2_axis);
run.section(,Lable_axis);
run.section(,Font_Size,xb_name$ yl_name$);
run.section(,Add_line);
run.section(,Add_label);
run.section(,Graph_set,pagename$);
run.section(,Legend_pos,$(xinc) $(yinc));
run.section(,Bottom_set);
//==================================
[Line]
set %C -d 0;              //Linetype  0:Solid 1:dash 2:Dot 3:Dash Dot
                         //          4:Dash Dot Dot 5:Short Dash
                         //          6:Short Dot    7:Short Dash Dot
set %C -cl color();       //LineColor Effect for Single Line
set %C -w  1000;          //LineWidth 100-->0.2pt 1000-->2pt
[X1_axis]
layer.x.type=1;           //x:bottom 0 or 1=linear
                         //              2=log10
                         //              3=probalility
                         //              4=probit
                         //              5=reciprocal
                         //              6=offset reciprocal
                         //              7=logit
                         //              8=In
                         //              9=log2
layer.x.from=%1;          //Start Value for X axis
layer.x.to  =%2;          //End Value for X axis
layer.x.inc =%3;          //Interval Value for X axis
layer.x.thickness=2;      //Width for X axis
//layer.x.atZero=0;       //Y=0 for X axis,X=0 for Y axis
                         //1: Show 0=hide
//layer.x.majorTicks=0;     //Major Ticks for X axis.Number by point
//layer.x.minorTicks=0;     //number of minor ticks in X axis
layer.x.ticks=10;         //ticks in or out
                         //0:no   1:major in  2:major out
                         //3:major in and out 4:minor in
                         //5:major in and minor in 
                         //6:major out and minor in
                         //7:major in and out and minor in
                         //8:minor out        9:major in and minor in
                         //10:major and minor out
                         //11:major in and out and minor out
                         //12:minor in and out
                         //13:major in and minor in and out
                         //14:major out and minor in and out
                         //15:major in out and minor in out
//layer.x.whiteout=0;       //with white around labels.1:enble 0:disable
//layer.x.showLabels=1;   //Show tick labels on axes.
                         //0: disable 1:show at bottom
                         //2: show at top 3:show at bottom and top
//layer.x.showGrids=0;    //Grid display
                         //0:hide grid 1:show major grids
                         //2:show minor grids 3:show major and minor grids
//layer.x.showAxes=1;     //Axis and tick display
                         //0:hide axes  1:show ticks on axis
                         //2:show ticks on opposite axis(x2)
                         //3:show ticks on both axes
                         //PS:layer.x2.showAxes will do the same thing.
//layer.x.reverse=0;        //Reverse axis direction
                         //0:disable 1:enable
//layer.x.rescale=3;        //Rescale type: 
                         //1:manual 2:normal, 3:auto, 4:fixed from 5:fixed to.
//layer.x.opposite=0;       //Line opposite the axis. 0: disable 1:enable
//layer.x.labelSubtype=1; //Tick label format
                         //1:decimal 2:scientific
                         //3:engineering(1K) 4:decimal(1,000).
//layer.x.firstTick=0;    //First tick value
layer.x.color= color(black);      //Axis color
[Y1_axis]
layer.y.type=1;
layer.y.from=%1;
layer.y.to  =%2;
layer.y.inc =%3;
layer.y.thickness=2;
//layer.y.atZero=0;
layer.y.majorTicks=0;
layer.y.minorTicks=0;
layer.y.ticks= 10;
//layer.y.whiteout=0;
layer.y.showLabels=1;
//layer.y.showGrids=0;
//layer.y.showAxes=1;
//layer.y.reverse=0;
//layer.y.rescale=3;
//layer.y.opposite=0;
//layer.y.labelSubtype=1;
//layer.y.firstTick=0;
layer.y.color= color(black);
[X2_axis]
//layer.x2.type=1;
//layer.x2.from=$(yfrom);
//layer.x2.to  =$(yto);
//layer.x2.inc =$(yinc);
layer.x2.thickness=2;
//layer.x2.atZero=0;
//layer.x2.majorTicks=0;
//layer.x2.minorTicks=0;
layer.x2.ticks=0;
//layer.x2.whiteout=0;
//layer.x2.showLabels=1;
//layer.x2.showGrids=0;
layer.x2.showAxes=3;
//layer.x2.reverse=0;
//layer.x2.rescale=3;
//layer.x2.opposite=0;
//layer.x2.labelSubtype=1;
//layer.x2.firstTick=0;
//layer.x2.color= color(black);
[Y2_axis]
//layer.y2.type=1;
//layer.y2.from=$(yfrom);
//layer.y2.to  =$(yto);
//layer.y2.inc =$(yinc);
layer.y2.thickness=2;
//layer.y2.atZero=0;
//layer.y2.majorTicks=0;
//layer.y2.minorTicks=0;
layer.y2.ticks=0;
//layer.y2.whiteout=0;
//layer.y2.showLabels=1;
//layer.y2.showGrids=0;
layer.y2.showAxes=3;
//layer.y2.reverse=0;
//layer.y2.rescale=3;
//layer.y2.opposite=0;
//layer.y2.labelSubtype=1;
//layer.y2.firstTick=0;
//layer.y2.color= color(black);
[Lable_axis]
layer.x.label.type=1;     //Tick label type: 
                         //1:numeric 2:text from dataset 3:time
                         //4:date 5:month 6:day of the week
                         //7:column headings 8:dataset indexed as tick
layer.y.label.type=1;
[Font_Size]
xb.text$=%1;
yl.text$=%2;
xb.fsize=28;
layer.x.label.pt=24;
layer.x.label.font=font(Times New Roman);  //Arial/仿宋/宋体/楷体
xb.font=font(Times New Roman);
layer.x.label.bold=1;     //Bold the tick labels: 1 = enable, 0 = disable
layer.x.label.rotate=0;   //Tick label rotation, in degrees.
yl.fsize=28;
layer.y.label.pt=24;
yl.font=font(Times New Roman);
layer.y.label.font=font(Times New Roman);
layer.y.label.bold=1;     //Bold the tick labels: 1 = enable, 0 = disable
layer.y.label.rotate=0;   //Tick label rotation, in degrees.
legend.fsize=24;
legend.font=font(Times New Roman);
legend.background=0;
[Add_line]
//draw -c value -d value -w value -l {x1,y1,x2,y2}
//draw -c value -d value -w value -l -v value(x)
//draw -c value -d value -w value -l -h value(y)
//c:color[0:black 1:red 2:green 3:blue 4:Cyan 6:Yellow]
//d:dash[0:solid 1:dash 2:dot 3:] Ref:set %C -d
//w:width[0.2 0.5 1 1.5 2 3 4 5]
//v:Vertical[x position]
//h:horizontal[y position]
//draw -c 0 -d 1 -w 2 -l -v 0;
[Add_label]
// label -a 0.25 0 \f:Times New Roman(\g(e)-\g(e)\-(f));
//label -a 0.25 0 \g(e)-\g(e)\-(f);
[Graph_set]
layer.width=80;
layer.height=layer.width*(5^0.5-1)/2;
layer.top=2;
layer.left=10;
//layer.border=0;        //Layer border pattern
                      //0:off 1:shadow 2:marble 
                      //3:white out 4:black out.
//layer.color=color();   //background color for layer
//layer.exchangexy=0;    //exchang x and y axis,1 = true, 0 = false
page.longname$=%1;        //name of active layer 
//layer.showData=0;      //show data points.1 = show, 0 = hide.
layer.showLabel=1;     //show label and others object  1 = show, 0 = hide
//layer.showx=1;         //Show x axis
//layer.showy=1;         //Show y axis
//axis -ps Y G 3;
//axis -ps X G 3;
[Legend_pos]
legend.x=layer.x.to - %1*1.5 ;//place legend to x position
legend.y=layer.y.to - %2 ;//place legend to y position
//legend.text$="text";
[Bottom_set]
sec -p 2;
xb.x = layer.x.from+(layer.x.to - layer.x.from)/2; //position of x axis
xb.y = layer.y.from-xb.dy*1.5;
yl.x = layer.x.from-yl.dx*2.0;                     //position of x axis
yl.y = layer.y.from+(layer.y.to - layer.y.from)/2; //position of y axis
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值