Index . 블로그창고 . Any comments?

\cat programming

legend.mp
histogram.mp
Links

legend.mp

legend_ex.mp

input TEX;
input graph;
input legend;
input math;

beginfig(1);
draw begingraph(4in, 2in);

picture key[], dash[];

key0 := btex $\sin(x)$ etex;
key1 := btex $\cos(x)$ etex;

dash0 := nullpicture;
dash1 := evenly;

gdraw fpath(sin)(0, 0.1, 2*pi) dashed dash0;
gdraw fpath(cos)(0, 0.1, 2*pi) dashed dash1;

setrange(0, -1, 2*pi, 1);

color gridcolor;
gridcolor := 0.70*white;

autogrid(, grid.lft) withcolor gridcolor;
grid.bot("0", 0) withcolor gridcolor;
grid.bot(btex $\pi$ etex, pi) withcolor gridcolor;
for x=0.5, 1.5, 2:
	grid.bot(TEX(decimal(x) & "$\pi$"), x*pi) withcolor gridcolor;
endfor;

glabel.bot(btex $x$ etex, OUT);
glabel.lft(btex $f(x)$ etex, OUT);

glabel.rt(legend(1cm)(key, dash), OUT);

endgraph;
endfig;
end;

histogram.mp

histogram_ex.txt

1084072.500000 2
1115945.000000 1
1147817.500000 6
1179690.000000 11
1211562.500000 23
1243435.000000 39
1275307.500000 64
1307180.000000 82
1339052.500000 96
1370925.000000 104
1402797.500000 108
1434670.000000 86
1466542.500000 106
1498415.000000 87
1530287.500000 73
1562160.000000 43
1594032.500000 25
1625905.000000 23
1657777.500000 11
1689650.000000 7
1721522.500000 13

histogram_ex

input graph;
input sarith;
input histogram;

beginfig(1);
draw histogram(btex Distribution of $N$ etex)("histogram_ex.txt")
	(4in, 2in) 
	(btex $N (10^6 mg/L)$ etex, btex Frequency etex rotated 90)
	("1e6", "1")
	(1.1, 0.1, 1.8)(0, 20, 100)
	(blue, 0.70*white);
endfig;
end;

Links


All the works in this site except software and copyrighted materials by others (e.g., 문학) are licensed under a Creative Commons License. 소프트웨어 및 문학과 같이 다른 이에게 저작권이 있는 작품을 제외하고 모두 크리에이티브 커먼즈 라이센스를 따른다.
Mon Mar 25 01:14:35 2024 . XHTML . CSS (lightbox.css is not part of Uniqki. ;-) . Powered by Uniqki!
refresh . edit . loginout . index