source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/missing-data/graph_idraw.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 1.7 KB
Line 
1function o = graph_idraw(ifile, means, stds_low, stds_hi, minval, maxval)
2% This writes to an idraw file a set of lines that graph a set of function values
3% along with error bars. 
4% Values are assumed to lie in between MINVAL and MAXVAL. 
5% If STDS has a zero value, no error bar is drawn.  (not implemented)
6% stds_low is mean-std, stds_hi is mean+std.  We don't just pass stds
7% in case a log scale is used.
8
9% For this to work, ifile must already contain a template idraw file, generated
10% with a line, that is then removed.  The end of the file must be removed, and must be
11% added later.  It looks like:
12
13%End %I eop
14
15%showpage
16
17%%%Trailer
18
19%end
20
21o = 1;
22irec_lx = 50;
23irec_ly = 50;
24irec_ux = 500;
25irec_uy = 500;
26% We write to an image rectangle with l giving lower corner, u upper.
27stdline = 5;
28dotrad = 6;
29
30numvals = size(means,2);
31x_len = irec_ux - irec_lx;
32xspace = x_len/(numvals + 1);
33xvals = round(irec_lx + xspace*(1:numvals));
34
35y_len = irec_uy - irec_ly;
36yvals = round(irec_ly + y_len*(means - minval)./(maxval-minval));
37
38if ~isempty(stds_low)
39  ystdmin = round(irec_ly + y_len*(stds_low - minval)./(maxval-minval));
40  ystdmax = round(irec_ly + y_len*(stds_hi - minval)./(maxval-minval));
41end
42
43fid = fopen(ifile, 'a');
44for i = 1:numvals
45   x = xvals(i);
46   if ~isempty(stds_low)
47     ymin = ystdmin(i);
48     ymax = ystdmax(i);
49     line_idraw(fid, x, ymin, x, ymax);
50     line_idraw(fid, x-stdline, ymin, x+stdline, ymin);
51     line_idraw(fid, x-stdline, ymax, x+stdline, ymax);
52  end
53  dot_idraw(fid, x, yvals(i), dotrad);
54end
55for i = 1:(numvals - 1)
56  x = xvals(i);
57  nextx = xvals(i+1);
58  y = yvals(i);
59  nexty = yvals(i+1);
60  line_idraw(fid, x, y, nextx, nexty);
61end
62fclose(fid);
Note: See TracBrowser for help on using the repository browser.