1 | function o = label_graph(ifile, xlabs, xminval, xmaxval, ylabs, yminval, ymaxval) |
---|
2 | % Draw Axis for graph, on left and bottom of bounding rect. |
---|
3 | % Add hash marks for labels. |
---|
4 | % Also, write stuff to close file. |
---|
5 | |
---|
6 | o = 1; |
---|
7 | irec_lx = 50; |
---|
8 | irec_ly = 50; |
---|
9 | irec_ux = 500; |
---|
10 | irec_uy = 500; |
---|
11 | lab_length = 20; |
---|
12 | % We write to an image rectangle with l giving lower corner, u upper. |
---|
13 | % This must be same values as in graph_idraw. |
---|
14 | |
---|
15 | fid = fopen(ifile, 'a'); |
---|
16 | line_idraw(fid, irec_lx, irec_ly, irec_lx, irec_uy); |
---|
17 | line_idraw(fid, irec_lx, irec_ly, irec_ux, irec_ly); |
---|
18 | |
---|
19 | x_len = irec_ux - irec_lx; |
---|
20 | xvals = irec_lx + round(x_len*(xlabs - xminval)./(xmaxval-xminval)); |
---|
21 | |
---|
22 | y_len = irec_uy - irec_ly; |
---|
23 | yvals = irec_ly + round(y_len*(ylabs - yminval)./(ymaxval-yminval)); |
---|
24 | |
---|
25 | for x = xvals |
---|
26 | line_idraw(fid, x, irec_ly, x, irec_ly - lab_length); |
---|
27 | end |
---|
28 | |
---|
29 | for y = yvals |
---|
30 | line_idraw(fid, irec_lx - lab_length, y, irec_lx, y); |
---|
31 | end |
---|
32 | |
---|
33 | fprintf(fid, '\n\nEnd %%I eop\n\nshowpage\n\n%%%%Trailer\n\nend'); |
---|
34 | fclose(fid); |
---|
35 | |
---|