Skip to content

Commit

Permalink
figures for date
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuo committed Aug 7, 2010
1 parent 45b340a commit 2f35de9
Show file tree
Hide file tree
Showing 3 changed files with 200 additions and 0 deletions.
4 changes: 4 additions & 0 deletions datetime/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
gpic shift_month.pic | groff | ps2eps | eps2png
mpost linear_regression.mp
#eps2png
62 changes: 62 additions & 0 deletions datetime/linear_regression.mp
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
beginfig(1);
draw (0,0)--(100,0);
draw (0,0)--(0,100);
for m=0 upto 11:
dotlabel.bot("", (m*20,0));
endfor
draw (-5,-5)--(80, 122);
pickup pencircle scaled 2pt;
drawdot(00,04) withcolor 0.6white;

drawdot(20,30);
drawdot(20,34) withcolor 0.6white;

drawdot(40,57);
drawdot(40,61) withcolor 0.6white;

drawdot(60,90);
drawdot(60,94) withcolor 0.6white;
pickup pencircle scaled 0.6pt;
draw fullcircle scaled 1.7pt shifted (00, 08);
draw fullcircle scaled 1.7pt shifted (20, 38);
draw fullcircle scaled 1.7pt shifted (40, 65);
draw fullcircle scaled 1.7pt shifted (60, 98);
endfig;

beginfig(2);
draw (0,0)--(400,0) withcolor 0.7white;
draw (0,0)--(0,350) withcolor 0.7white;

pickup pencircle scaled 2pt;
for m=0 upto 11:
drawdot(30*m, 0);
endfor
pickup pencircle scaled 1pt;
drawdot(30*1, 31);
drawdot(30*2, 61);
drawdot(30*3, 92);
drawdot(30*4, 122);
drawdot(30*5, 153);
drawdot(30*6, 184);
drawdot(30*7, 214);
drawdot(30*8, 245);
drawdot(30*9, 275);
drawdot(30*10, 306);

drawdot(30*1, 32);
drawdot(30*2, 62);
drawdot(30*3, 93);
drawdot(30*4, 123);
drawdot(30*5, 154);
drawdot(30*6, 185);
drawdot(30*7, 215);
drawdot(30*8, 246);
drawdot(30*9, 276);
drawdot(30*10, 307);

pickup pencircle scaled 0.5pt;
draw(0,0.4)--(11*30,337) withcolor 0.6white;
endfig;

end

134 changes: 134 additions & 0 deletions datetime/shift_month.pic
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
.PS
# days in month
B1: box "30" width 0.2 height 0.16
box "31" same
box "31" same
box "\fB28\fR" same fill 0.3
box "31" same
box "30" same
box "31" same
box "30" same
box "31" same
box "31" same
box "30" same
box "31" same
box "30" same
box "31" same
box "31" same
box "\fB29\fR" same fill 0.3
box "31" same
box "30" same
box "31" same
box "30" same
box "31" same
box "31" same
box "30" same
box "31" same
box "30" same
box "31" same
box "31" same
box "\fB28\fR" same fill 0.3
box "31" same
box "30" same
# months
box "\s-211" invis same at B1+(0, 0.18)
box "12" invis same
box "1" invis same
box "2" invis same
box "3" invis same
box "4" invis same
box "5" invis same
box "6" invis same
box "7" invis same
box "8" invis same
box "9" invis same
box "10" invis same
box "11" invis same
box "12" invis same
box "1" invis same
box "2" invis same
box "3" invis same
box "4" invis same
box "5" invis same
box "6" invis same
box "7" invis same
box "8" invis same
box "9" invis same
box "10" invis same
box "11" invis same
box "12" invis same
box "1" invis same
box "2" invis same
box "3" invis same
box "4" invis same
# shifted months
box "8" invis same at B1-(0, 0.18)
box "9" invis same
box "10" invis same
box "11" invis same
box "0" invis same
box "1" invis same
box "2" invis same
box "3" invis same
box "4" invis same
box "5" invis same
box "6" invis same
box "7" invis same
box "8" invis same
box "9" invis same
box "10" invis same
box "11" invis same
box "0" invis same
box "1" invis same
box "2" invis same
box "3" invis same
box "4" invis same
box "5" invis same
box "6" invis same
box "7" invis same
box "8" invis same
box "9" invis same
box "10" invis same
box "11" invis same
box "0" invis same
box "1" invis same
# labels and years
box "month" invis same at B1-(0.3, -0.18)
box "\fBmonth'\fR" invis same at B1-(0.3, 0.18)
box "year" invis width 0.4 at B1-(0.3, -0.36)
Y1: box "\s+2 2006" width 0.4 invis
Y2: box "2007" width 2.4 invis
Y3: box "2008" width 2.4 invis
box "2009" width 0.8 invis
box "\s-2\fByear'\fR" invis width 0.4 at B1-(0.3, 0.36)
Y4: box "\s+2 2006" width 0.8 invis
Y5: box "2007" width 2.4 invis
Y6: box "2008" width 2.4 invis
box "2009" width 0.4 invis
line from Y1.ne-(0,0.15) to Y1.se
line from Y2.ne-(0,0.15) to Y2.se
line from Y3.ne-(0,0.15) to Y3.se
line from Y4.ne to Y4.se+(0,0.15)
line from Y5.ne to Y5.se+(0,0.15)
line from Y6.ne to Y6.se+(0,0.15)
.PE

0 comments on commit 2f35de9

Please sign in to comment.