带有break Y axis (破断线Y轴)的图形

/* Set graphics options */
FILENAME file “c:\breakaxis.png”;
goptions reset=all vsize=14cm hsize=14cm noborder device=png gsfname=file;;

/* Create input data set, A */
data a;
input xvar yvar  g;
datalines;
1 2 1
2 4 1
3 3 1
4 5 1
5 9 1
6 7 1
7 8 1
8 9 1
9 6 1
10 7 1
1 1500 2
2 4000 2
3 3000 2
4 3200 2
5 6000 2
6 6500 2
7 7300 2
8 5300 2
9 7000 2
10 6500 2
1 1800 3
2 2000 3
3 2500 3
4 3200 3
5 5000 3
6 5500 3
7 6000 3
8 8000 3
9 7500 3
10 7000 3
;

/* Create annotate data set, ANNO */
data anno;
length function style color $8;
retain xsys ‘5’ ysys ‘2’  when ‘a’ style ‘solid’;
/* Draw a solid white box to cover the vaxis area where the */
/* break occurs.                                            */
function=’move’; x=1; y=50; output;
function=’bar’; x=8;  y=300;  color=’white’; output;
/* Now draw the jagged line where the vaxis breaks. */
color=’black’; size=1;
function=’move’; xsys=’1′; x=0;  ysys=’2′; y=65;  output;
function=’draw’; xsys=’B’; ysys=’B’; x=+2; y=+3.5; output;
function=’draw’;                  x=-4; y=+3; output;
function=’draw’; xsys=’1′; x=0;  ysys=’2′; y=285; output;
run;

/* Assign symbol definitions */
symbol1 i=j v=none c=blue w=6;
symbol2 i=j v=none c=orange w=6;
symbol3 i=j v=none c=red w=6;
/* Add the title */
title1 h=2.5 ‘Break Vaxis’;
/* Create axis definitions */
title3 justify=l  ‘Data from:…’;
title4 justify=l  ‘Code available: sxlion.blog.sohu.com’;
axis1 order=(0 to 8 by 4, 250 1000 to 10000 by 3000)
minor=none width=1;
axis2 order=(0 to 10.5 by 1) minor=none width=1;
/* Produce the plot */
proc gplot data=a;
plot yvar*xvar=g / vaxis=axis1 haxis=axis2  noframe
anno=anno
nolegend
;
run;
quit;


相关博文

发表评论

电子邮件地址不会被公开。 必填项已用*标注