changeset 11363:a0dfd7e8e3e2

Assign data used in demo plots for reproducibility between runs
author Rik <octave@nomad.inbox5.com>
date Tue, 14 Dec 2010 17:27:19 -0800
parents 456752abad08
children 4cab008d3be1
files scripts/ChangeLog scripts/plot/compass.m scripts/plot/errorbar.m scripts/plot/legend.m scripts/plot/rose.m scripts/plot/scatter.m scripts/plot/scatter3.m scripts/plot/stairs.m
diffstat 8 files changed, 79 insertions(+), 46 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Tue Dec 14 02:01:59 2010 -0500
+++ b/scripts/ChangeLog	Tue Dec 14 17:27:19 2010 -0800
@@ -1,3 +1,9 @@
+2010-12-14  Rik  <octave@nomad.inbox5.com>
+
+	* plot/compass.m, plot/errorbar.m, plot/legend.m, plot/rose.m, 
+	plot/scatter.m, plot/scatter3.m, plot/stairs.m: Assign data used in 
+	demo plots for reproducibility between runs.
+
 2010-12-13  Rik  <octave@nomad.inbox5.com>
 
 	* statistics/median.m: Add NaN test case from bug #29930.
--- a/scripts/plot/compass.m	Tue Dec 14 02:01:59 2010 -0500
+++ b/scripts/plot/compass.m	Tue Dec 14 17:27:19 2010 -0800
@@ -110,6 +110,10 @@
 
 endfunction
 
+
 %!demo
-%! a = toeplitz([1;randn(9,1)],[1,randn(1,9)]);
-%! compass (eig (a))
+%! randn_9x1_data = [-2.555884; 0.394974; -0.191871; -1.147024; 1.355425; -0.437335; -0.014370; -0.941312; 1.240300];
+%! randn_1x9_data = [1.42934, -1.10821, -1.70404, 0.63357, -0.68337, -1.19771, -0.96502, -1.12810, 0.22457];
+%! a = toeplitz ([1;randn_9x1_data], [1,randn_1x9_data]);
+%! compass (eig (a));
+
--- a/scripts/plot/errorbar.m	Tue Dec 14 02:01:59 2010 -0500
+++ b/scripts/plot/errorbar.m	Tue Dec 14 17:27:19 2010 -0800
@@ -137,11 +137,16 @@
 
 endfunction
 
-%!demo
-%! errorbar(0:10,rand(1,11),0.25*rand(1,11))
 
 %!demo
-%! errorbar(0:10,rand(1,11),rand(1,11), ">")
+%! rand_1x11_data1 = [0.82712, 0.50325, 0.35613, 0.77089, 0.20474, 0.69160, 0.30858, 0.88225, 0.35187, 0.14168, 0.54270];
+%! rand_1x11_data2 = [0.506375, 0.330106, 0.017982, 0.859270, 0.140641, 0.327839, 0.275886, 0.162453, 0.807592, 0.318509, 0.921112];
+%! errorbar (0:10, rand_1x11_data1, 0.25*rand_1x11_data2);
+
+%!demo
+%! rand_1x11_data3 = [0.423650, 0.142331, 0.213195, 0.129301, 0.975891, 0.012872, 0.635327, 0.338829, 0.764997, 0.401798, 0.551850];
+%! rand_1x11_data4 = [0.682566, 0.456342, 0.132390, 0.341292, 0.108633, 0.601553, 0.040455, 0.146665, 0.309187, 0.586291, 0.540149];
+%! errorbar(0:10, rand_1x11_data3, rand_1x11_data4, ">");
 
 %!demo
 %! x = 0:0.5:2*pi; 
--- a/scripts/plot/legend.m	Tue Dec 14 02:01:59 2010 -0500
+++ b/scripts/plot/legend.m	Tue Dec 14 17:27:19 2010 -0800
@@ -984,51 +984,54 @@
   endwhile
 endfunction
 
-%!demo
-%! clf
-%! plot(1:10, 1:10, 1:10, fliplr(1:10));
-%! title("incline is blue and decline is green");
-%! legend({"I'm blue", "I'm green"}, "location", "east")
 
 %!demo
 %! clf
 %! plot(1:10, 1:10, 1:10, fliplr(1:10));
 %! title("incline is blue and decline is green");
-%! legend("I'm blue", "I'm green", "location", "east")
+%! legend({"I'm blue", "I'm green"}, "location", "east");
+
+%!demo
+%! clf
+%! plot(1:10, 1:10, 1:10, fliplr(1:10));
+%! title("incline is blue and decline is green");
+%! legend("I'm blue", "I'm green", "location", "east");
 
 %!demo
 %! clf
 %! plot(1:10, 1:10);
 %! title("a very long label can sometimes cause problems");
-%! legend({"hello world"}, "location", "northeastoutside")
+%! legend({"hello world"}, "location", "northeastoutside");
 
 %!demo
 %! clf
 %! plot(1:10, 1:10);
 %! title("a very long label can sometimes cause problems");
-%! legend("hello world", "location", "northeastoutside")
+%! legend("hello world", "location", "northeastoutside");
 
 %!demo
 %! clf
 %! labels = {};
 %! for i = 1:5
-%!     h = plot(1:100, i + rand(100,1)); hold on;
-%!     set (h, "color", get (gca, "colororder")(i,:))
-%!     labels = {labels{:}, cstrcat("Signal ", num2str(i))};
-%! endfor; hold off;
+%!   h = plot(1:100, i + rand(100,1)); hold on;
+%!   set (h, "color", get (gca, "colororder")(i,:))
+%!   labels = {labels{:}, cstrcat("Signal ", num2str(i))};
+%! endfor
+%! hold off;
 %! title("Signals with random offset and uniform noise")
 %! xlabel("Sample Nr [k]"); ylabel("Amplitude [V]");
-%! legend(labels, "location", "southoutside")
-%! legend("boxon")
+%! legend(labels, "location", "southoutside");
+%! legend("boxon");
 
 %!demo
 %! clf
 %! labels = {};
 %! for i = 1:5
-%!     h = plot(1:100, i + rand(100,1)); hold on;
-%!     set (h, "color", get (gca, "colororder")(i,:))
-%!     labels = {labels{:}, cstrcat("Signal ", num2str(i))};
-%! endfor; hold off;
+%!   h = plot(1:100, i + rand(100,1)); hold on;
+%!   set (h, "color", get (gca, "colororder")(i,:))
+%!   labels = {labels{:}, cstrcat("Signal ", num2str(i))};
+%! endfor
+%! hold off;
 %! title("Signals with random offset and uniform noise")
 %! xlabel("Sample Nr [k]"); ylabel("Amplitude [V]");
 %! legend(labels{:}, "location", "southoutside")
@@ -1057,19 +1060,22 @@
 
 %!demo
 %! clf
-%! bar (rand (2, 3))
-%! ylim ([0 1.2])
-%! legend ({"1st Bar", "2nd Bar", "3rd Bar"})
+%! rand_2x3_data1 = [0.341447, 0.171220, 0.284370; 0.039773, 0.731725, 0.779382];
+%! bar (rand_2x3_data1);
+%! ylim ([0 1.2]);
+%! legend ({"1st Bar", "2nd Bar", "3rd Bar"});
 
 %!demo
 %! clf
-%! bar (rand (2, 3))
-%! ylim ([0 1.2])
-%! legend ("1st Bar", "2nd Bar", "3rd Bar")
+%! rand_2x3_data2 = [0.44804, 0.84368, 0.23012; 0.72311, 0.58335, 0.90531];
+%! bar (rand_2x3_data2);
+%! ylim ([0 1.2]);
+%! legend ("1st Bar", "2nd Bar", "3rd Bar");
 
 %!demo
 %! clf
 %! x = 0:0.1:7;
 %! h = plot (x, sin(x), x, cos(x), x, sin(x.^2/10), x, cos(x.^2/10));
-%! title ("Only the sin() objects have keylabels")
-%! legend (h([1, 3]), {"sin(x)", "sin(x^2/10)"}, "location", "southwest")
+%! title ("Only the sin() objects have keylabels");
+%! legend (h([1, 3]), {"sin(x)", "sin(x^2/10)"}, "location", "southwest");
+
--- a/scripts/plot/rose.m	Tue Dec 14 02:01:59 2010 -0500
+++ b/scripts/plot/rose.m	Tue Dec 14 17:27:19 2010 -0800
@@ -105,5 +105,7 @@
 
 endfunction
 
+
 %!demo
-%! rose ([2*randn(1e5,1), pi + 2 * randn(1e5,1)])
+%! rose ([2*randn(1e5, 1), pi + 2*randn(1e5, 1)]);
+
--- a/scripts/plot/scatter.m	Tue Dec 14 02:01:59 2010 -0500
+++ b/scripts/plot/scatter.m	Tue Dec 14 17:27:19 2010 -0800
@@ -80,10 +80,11 @@
 
 endfunction
 
+
 %!demo
 %! x = randn (100, 1);
 %! y = randn (100, 1);
-%! scatter (x, y, "r")
+%! scatter (x, y, "r");
 
 %!demo
 %! x = randn (100, 1);
@@ -91,20 +92,26 @@
 %! scatter (x, y, [], sqrt(x.^2 + y.^2));
 
 %!demo
-%! x = rand (10, 1);
-%! y = rand (10, 1);
-%! s = 10 - 10 * log (x.^2+y.^2);
+%! rand_10x1_data1 = [0.171577, 0.404796, 0.025469, 0.335309, 0.047814, 0.898480, 0.639599, 0.700247, 0.497798, 0.737940];
+%! rand_10x1_data2 = [0.75495, 0.83991, 0.80850, 0.73603, 0.19360, 0.72573, 0.69371, 0.74388, 0.13837, 0.54143];
+%! x = rand_10x1_data1;
+%! y = rand_10x1_data2;
+%! s = 10 - 10*log (x.^2 + y.^2);
 %! h = scatter (x, y, s, s, "s", "filled");
 
 %!demo
-%! x = rand (10, 1);
-%! y = rand (10, 1);
-%! s = 10 - 10 * log (x.^2+y.^2);
+%! rand_10x1_data3 = [0.42262, 0.51623, 0.65992, 0.14999, 0.68385, 0.55929, 0.52251, 0.92204, 0.19762, 0.93726]; 
+%! rand_10x1_data4 = [0.020207, 0.527193, 0.443472, 0.061683, 0.370277, 0.947349, 0.249591, 0.666304, 0.134247, 0.920356];
+%! x = rand_10x1_data3;
+%! y = rand_10x1_data4;
+%! s = 10 - 10*log (x.^2 + y.^2);
 %! h = scatter (x, y, [], "r", "s", "filled");
 
 %!demo
-%! x = rand (10, 1);
-%! y = rand (10, 1);
-%! s = 10 - 10 * log (x.^2+y.^2);
+%! rand_10x1_data5 = [0.777753, 0.093848, 0.183162, 0.399499, 0.337997, 0.686724, 0.073906, 0.651808, 0.869273, 0.137949];
+%! rand_10x1_data6 = [0.37460, 0.25027, 0.19510, 0.51182, 0.54704, 0.56087, 0.24853, 0.75443, 0.42712, 0.44273];
+%! x = rand_10x1_data5;
+%! y = rand_10x1_data6;
+%! s = 10 - 10*log (x.^2 + y.^2);
 %! h = scatter (x, y, [], "r", "s");
 
--- a/scripts/plot/scatter3.m	Tue Dec 14 02:01:59 2010 -0500
+++ b/scripts/plot/scatter3.m	Tue Dec 14 17:27:19 2010 -0800
@@ -80,6 +80,7 @@
 
 endfunction
 
+
 %!demo
 %! [x, y, z] = peaks (20);
 %! scatter3 (x(:), y(:), z(:), [], z(:));
@@ -102,5 +103,3 @@
 %! z = rand (20,1);
 %! scatter3 (x(:), y(:), z(:), 20*z(:), [], "s");
 
-
-
--- a/scripts/plot/stairs.m	Tue Dec 14 02:01:59 2010 -0500
+++ b/scripts/plot/stairs.m	Tue Dec 14 17:27:19 2010 -0800
@@ -209,14 +209,17 @@
 
 endfunction
 
+
 %!demo
 %! x = 1:10;
-%! y = rand (1, 10);
+%! rand_1x10_data1 = [0.073, 0.455, 0.837, 0.124, 0.426, 0.781, 0.004, 0.024, 0.519, 0.698];
+%! y = rand_1x10_data1;
 %! stairs (x, y);
 
 %!demo
 %! x = 1:10;
-%! y = rand (1, 10);
+%! rand_1x10_data2 = [0.014, 0.460, 0.622, 0.394, 0.531, 0.378, 0.466, 0.788, 0.342, 0.893];
+%! y = rand_1x10_data2;
 %! [xs, ys] = stairs (x, y);
 %! plot (xs, ys);
 
@@ -227,6 +230,7 @@
 %! [xs, ys] = stairs (9:-1:1);
 %! plot (xs, ys);
 
+
 function update_props (h, d)
   set (get (h, "children"), "color", get (h, "color"), 
        "linewidth", get (h, "linewidth"),