Mercurial > hg > octave-lyh
comparison scripts/plot/legend.m @ 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 | c463aed850b0 |
children | a140991387fb |
comparison
equal
deleted
inserted
replaced
11362:456752abad08 | 11363:a0dfd7e8e3e2 |
---|---|
982 endif | 982 endif |
983 endif | 983 endif |
984 endwhile | 984 endwhile |
985 endfunction | 985 endfunction |
986 | 986 |
987 | |
987 %!demo | 988 %!demo |
988 %! clf | 989 %! clf |
989 %! plot(1:10, 1:10, 1:10, fliplr(1:10)); | 990 %! plot(1:10, 1:10, 1:10, fliplr(1:10)); |
990 %! title("incline is blue and decline is green"); | 991 %! title("incline is blue and decline is green"); |
991 %! legend({"I'm blue", "I'm green"}, "location", "east") | 992 %! legend({"I'm blue", "I'm green"}, "location", "east"); |
992 | 993 |
993 %!demo | 994 %!demo |
994 %! clf | 995 %! clf |
995 %! plot(1:10, 1:10, 1:10, fliplr(1:10)); | 996 %! plot(1:10, 1:10, 1:10, fliplr(1:10)); |
996 %! title("incline is blue and decline is green"); | 997 %! title("incline is blue and decline is green"); |
997 %! legend("I'm blue", "I'm green", "location", "east") | 998 %! legend("I'm blue", "I'm green", "location", "east"); |
998 | 999 |
999 %!demo | 1000 %!demo |
1000 %! clf | 1001 %! clf |
1001 %! plot(1:10, 1:10); | 1002 %! plot(1:10, 1:10); |
1002 %! title("a very long label can sometimes cause problems"); | 1003 %! title("a very long label can sometimes cause problems"); |
1003 %! legend({"hello world"}, "location", "northeastoutside") | 1004 %! legend({"hello world"}, "location", "northeastoutside"); |
1004 | 1005 |
1005 %!demo | 1006 %!demo |
1006 %! clf | 1007 %! clf |
1007 %! plot(1:10, 1:10); | 1008 %! plot(1:10, 1:10); |
1008 %! title("a very long label can sometimes cause problems"); | 1009 %! title("a very long label can sometimes cause problems"); |
1009 %! legend("hello world", "location", "northeastoutside") | 1010 %! legend("hello world", "location", "northeastoutside"); |
1010 | 1011 |
1011 %!demo | 1012 %!demo |
1012 %! clf | 1013 %! clf |
1013 %! labels = {}; | 1014 %! labels = {}; |
1014 %! for i = 1:5 | 1015 %! for i = 1:5 |
1015 %! h = plot(1:100, i + rand(100,1)); hold on; | 1016 %! h = plot(1:100, i + rand(100,1)); hold on; |
1016 %! set (h, "color", get (gca, "colororder")(i,:)) | 1017 %! set (h, "color", get (gca, "colororder")(i,:)) |
1017 %! labels = {labels{:}, cstrcat("Signal ", num2str(i))}; | 1018 %! labels = {labels{:}, cstrcat("Signal ", num2str(i))}; |
1018 %! endfor; hold off; | 1019 %! endfor |
1020 %! hold off; | |
1019 %! title("Signals with random offset and uniform noise") | 1021 %! title("Signals with random offset and uniform noise") |
1020 %! xlabel("Sample Nr [k]"); ylabel("Amplitude [V]"); | 1022 %! xlabel("Sample Nr [k]"); ylabel("Amplitude [V]"); |
1021 %! legend(labels, "location", "southoutside") | 1023 %! legend(labels, "location", "southoutside"); |
1022 %! legend("boxon") | 1024 %! legend("boxon"); |
1023 | 1025 |
1024 %!demo | 1026 %!demo |
1025 %! clf | 1027 %! clf |
1026 %! labels = {}; | 1028 %! labels = {}; |
1027 %! for i = 1:5 | 1029 %! for i = 1:5 |
1028 %! h = plot(1:100, i + rand(100,1)); hold on; | 1030 %! h = plot(1:100, i + rand(100,1)); hold on; |
1029 %! set (h, "color", get (gca, "colororder")(i,:)) | 1031 %! set (h, "color", get (gca, "colororder")(i,:)) |
1030 %! labels = {labels{:}, cstrcat("Signal ", num2str(i))}; | 1032 %! labels = {labels{:}, cstrcat("Signal ", num2str(i))}; |
1031 %! endfor; hold off; | 1033 %! endfor |
1034 %! hold off; | |
1032 %! title("Signals with random offset and uniform noise") | 1035 %! title("Signals with random offset and uniform noise") |
1033 %! xlabel("Sample Nr [k]"); ylabel("Amplitude [V]"); | 1036 %! xlabel("Sample Nr [k]"); ylabel("Amplitude [V]"); |
1034 %! legend(labels{:}, "location", "southoutside") | 1037 %! legend(labels{:}, "location", "southoutside") |
1035 %! legend("boxon") | 1038 %! legend("boxon") |
1036 | 1039 |
1055 %! plot (x, x, x, x.^2); | 1058 %! plot (x, x, x, x.^2); |
1056 %! legend ("linear", "quadratic"); | 1059 %! legend ("linear", "quadratic"); |
1057 | 1060 |
1058 %!demo | 1061 %!demo |
1059 %! clf | 1062 %! clf |
1060 %! bar (rand (2, 3)) | 1063 %! rand_2x3_data1 = [0.341447, 0.171220, 0.284370; 0.039773, 0.731725, 0.779382]; |
1061 %! ylim ([0 1.2]) | 1064 %! bar (rand_2x3_data1); |
1062 %! legend ({"1st Bar", "2nd Bar", "3rd Bar"}) | 1065 %! ylim ([0 1.2]); |
1063 | 1066 %! legend ({"1st Bar", "2nd Bar", "3rd Bar"}); |
1064 %!demo | 1067 |
1065 %! clf | 1068 %!demo |
1066 %! bar (rand (2, 3)) | 1069 %! clf |
1067 %! ylim ([0 1.2]) | 1070 %! rand_2x3_data2 = [0.44804, 0.84368, 0.23012; 0.72311, 0.58335, 0.90531]; |
1068 %! legend ("1st Bar", "2nd Bar", "3rd Bar") | 1071 %! bar (rand_2x3_data2); |
1072 %! ylim ([0 1.2]); | |
1073 %! legend ("1st Bar", "2nd Bar", "3rd Bar"); | |
1069 | 1074 |
1070 %!demo | 1075 %!demo |
1071 %! clf | 1076 %! clf |
1072 %! x = 0:0.1:7; | 1077 %! x = 0:0.1:7; |
1073 %! h = plot (x, sin(x), x, cos(x), x, sin(x.^2/10), x, cos(x.^2/10)); | 1078 %! h = plot (x, sin(x), x, cos(x), x, sin(x.^2/10), x, cos(x.^2/10)); |
1074 %! title ("Only the sin() objects have keylabels") | 1079 %! title ("Only the sin() objects have keylabels"); |
1075 %! legend (h([1, 3]), {"sin(x)", "sin(x^2/10)"}, "location", "southwest") | 1080 %! legend (h([1, 3]), {"sin(x)", "sin(x^2/10)"}, "location", "southwest"); |
1081 |