Mercurial > hg > octave-lyh
comparison scripts/plot/semilogy.m @ 13103:2e2738837a24
Add tests and demos for log-scale plotting functions
* semilogx.m, semilogy.m, loglog.m : Add new tests and demos.
author | Carlo de Falco <kingcrimson@tiscali.it> |
---|---|
date | Tue, 06 Sep 2011 15:38:32 +0200 |
parents | 7f127e079a7c |
children | 3b5449493bb8 |
comparison
equal
deleted
inserted
replaced
13102:801c5a6ad487 | 13103:2e2738837a24 |
---|---|
64 %!demo | 64 %!demo |
65 %! x = 1:0.01:10; | 65 %! x = 1:0.01:10; |
66 %! y = (x .* (1 + rand (size (x)))) .^ 2; | 66 %! y = (x .* (1 + rand (size (x)))) .^ 2; |
67 %! semilogy (x, y); | 67 %! semilogy (x, y); |
68 | 68 |
69 ## Remove from test statistics. No real tests possible. | 69 %!demo |
70 %!assert (1) | 70 %! clf (); |
71 %! a = logspace (-5, 1, 10); | |
72 %! b =-logspace (-5, 1, 10); | |
73 %! | |
74 %! subplot (1, 2, 1) | |
75 %! semilogy (a, b) | |
76 %! xlabel ('semilogy (a, b)') | |
77 %! | |
78 %! subplot (1, 2, 2) | |
79 %! semilogy (a, abs (b)) | |
80 %! set (gca, 'ydir', 'reverse') | |
81 %! xlabel ('semilogy (a, abs (b))') | |
82 %! | |
83 %! fprintf ('the two plots should look the same except for the sign in y tick labels') | |
84 | |
85 %!test | |
86 %! hf = figure (1232, "visible", "off"); | |
87 %! unwind_protect | |
88 %! a = logspace (-5, 1, 10); | |
89 %! b = logspace (-5, 1, 10); | |
90 %! semilogy (a, b) | |
91 %! assert (get (gca, "yscale"), "log"); | |
92 %! assert (get (gca, "xscale"), "linear"); | |
93 %! unwind_protect_cleanup | |
94 %! close (hf); | |
95 %! end_unwind_protect | |
96 | |
97 %!test | |
98 %! hf = figure (1232, "visible", "off"); | |
99 %! unwind_protect | |
100 %! a = logspace (-5, 1, 10); | |
101 %! b =-logspace (-5, 1, 10); | |
102 %! semilogy (a, b) | |
103 %! axis tight | |
104 %! assert (all (get (gca, "ytick") < 0)); | |
105 %! unwind_protect_cleanup | |
106 %! close (hf); | |
107 %! end_unwind_protect | |
108 | |
109 |