changeset 24388:206ef5cb8b16

Add titles to most plot demos. * annotation.m, axis.m, camlookat.m, camorbit.m, campos.m, camroll.m, camtarget.m, camup.m, camva.m, camzoom.m, grid.m, isocaps.m, isosurface.m, pareto.m, plotmatrix.m, plotyy.m, shrinkfaces.m, slice.m, trimesh.m, triplot.m, trisurf.m, axes.m, zoom.m: Add titles to demos.
author Rik <rik@octave.org>
date Thu, 07 Dec 2017 17:37:05 -0800
parents 268d31e7aa4f
children 3ef6430ab807
files scripts/plot/appearance/annotation.m scripts/plot/appearance/axis.m scripts/plot/appearance/camlookat.m scripts/plot/appearance/camorbit.m scripts/plot/appearance/campos.m scripts/plot/appearance/camroll.m scripts/plot/appearance/camtarget.m scripts/plot/appearance/camup.m scripts/plot/appearance/camva.m scripts/plot/appearance/camzoom.m scripts/plot/appearance/grid.m scripts/plot/draw/isocaps.m scripts/plot/draw/isosurface.m scripts/plot/draw/pareto.m scripts/plot/draw/plotmatrix.m scripts/plot/draw/plotyy.m scripts/plot/draw/shrinkfaces.m scripts/plot/draw/slice.m scripts/plot/draw/trimesh.m scripts/plot/draw/triplot.m scripts/plot/draw/trisurf.m scripts/plot/util/axes.m scripts/plot/util/zoom.m
diffstat 23 files changed, 117 insertions(+), 78 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/appearance/annotation.m	Thu Dec 07 13:47:55 2017 -0800
+++ b/scripts/plot/appearance/annotation.m	Thu Dec 07 17:37:05 2017 -0800
@@ -1460,6 +1460,7 @@
 %!                   "linestyle", "--", "headstyle", "none");
 %! endfor
 %! set (h, "string", "Extrema", "fontsize", 15);
+%! title ("annotation() demo of TextArrows");
 
 ## test line properties
 %!test
--- a/scripts/plot/appearance/axis.m	Thu Dec 07 13:47:55 2017 -0800
+++ b/scripts/plot/appearance/axis.m	Thu Dec 07 17:37:05 2017 -0800
@@ -582,72 +582,13 @@
 %! s = x1 / max (x(:));
 %! pcolor (s*x+x1, s*y+x1/2, 5*z);
 %! axis tight;
+%! title ('"tight" when two axes objects exist');
 
 %!demo
 %! clf;
 %! loglog (1:20, "-s");
 %! axis tight;
-
-## FIXME: These demos aren't actually of the axis function.
-##        They are demos for an axes object and belong elsewhere.
-%!demo
-%! clf;
-%! x = -10:10;
-%! plot (x,x, x,-x);
-%! set (gca, "yscale", "log");
-%! legend ({"x >= 1", "x <= 1"}, "location", "north");
-%! title ("ylim = [1, 10]");
-
-%!demo
-%! clf;
-%! x = -10:0.1:10;
-%! y = sin (x)./(1 + abs (x)) + 0.1*x - 0.4;
-%! plot (x, y);
-%! set (gca, "xaxislocation", "origin");
-%! set (gca, "yaxislocation", "origin");
-%! box off;
-%! title ({"no plot box", "xaxislocation = origin, yaxislocation = origin"});
-
-%!demo
-%! clf;
-%! x = -10:0.1:10;
-%! y = sin (x)./(1+abs (x)) + 0.1*x - 0.4;
-%! plot (x, y);
-%! set (gca, "xaxislocation", "origin");
-%! set (gca, "yaxislocation", "left");
-%! box off;
-%! title ({"no plot box", "xaxislocation = origin, yaxislocation = left"});
-
-%!demo
-%! clf;
-%! x = -10:0.1:10;
-%! y = sin (x)./(1+abs (x)) + 0.1*x - 0.4;
-%! plot (x, y);
-%! title ("no plot box");
-%! set (gca, "xaxislocation", "origin");
-%! set (gca, "yaxislocation", "right");
-%! box off;
-%! title ({"no plot box", "xaxislocation = origin, yaxislocation = right"});
-
-%!demo
-%! clf;
-%! x = -10:0.1:10;
-%! y = sin (x)./(1+abs (x)) + 0.1*x - 0.4;
-%! plot (x, y);
-%! set (gca, "xaxislocation", "bottom");
-%! set (gca, "yaxislocation", "origin");
-%! box off;
-%! title ({"no plot box", "xaxislocation = bottom, yaxislocation = origin"});
-
-%!demo
-%! clf;
-%! x = -10:0.1:10;
-%! y = sin (x)./(1+abs (x)) + 0.1*x - 0.4;
-%! plot (x, y);
-%! set (gca, "xaxislocation", "top");
-%! set (gca, "yaxislocation", "origin");
-%! box off;
-%! title ({"no plot box", "xaxislocation = top, yaxislocation = origin"});
+%! title ('"tight" on loglog plot');
 
 %!test
 %! hf = figure ("visible", "off");
--- a/scripts/plot/appearance/camlookat.m	Thu Dec 07 13:47:55 2017 -0800
+++ b/scripts/plot/appearance/camlookat.m	Thu Dec 07 17:37:05 2017 -0800
@@ -159,6 +159,7 @@
 %! s2 = surf (x/5+0.2, y/5-2, z/5+1);
 %! axis equal
 %! axis tight
+%! title ("camlookat() demo #1");
 %! pause (1);
 %! camlookat (s1);
 %! pause (1);
--- a/scripts/plot/appearance/camorbit.m	Thu Dec 07 13:47:55 2017 -0800
+++ b/scripts/plot/appearance/camorbit.m	Thu Dec 07 17:37:05 2017 -0800
@@ -183,6 +183,7 @@
 %!demo
 %! clf;
 %! peaks ();
+%! title ("camorbit() demo #1");
 %! ## rotate the camera upwards
 %! camorbit (0, 30);
 %! ## rotate the camera right
--- a/scripts/plot/appearance/campos.m	Thu Dec 07 13:47:55 2017 -0800
+++ b/scripts/plot/appearance/campos.m	Thu Dec 07 17:37:05 2017 -0800
@@ -108,10 +108,11 @@
 %!demo
 %! clf;
 %! sphere ();
+%! title ("campos() demo #1");
 %! ## where is camera located?
 %! x1 = campos ()
 %! ## move the camera upwards
-%! campos (x1 + [0 0 2])
+%! campos (x1 + [0 0 2]);
 %! x2 = campos ()
 
 %!test
--- a/scripts/plot/appearance/camroll.m	Thu Dec 07 13:47:55 2017 -0800
+++ b/scripts/plot/appearance/camroll.m	Thu Dec 07 17:37:05 2017 -0800
@@ -94,7 +94,8 @@
 %!demo
 %! clf;
 %! peaks ();
-%! camroll (30)
+%! camroll (30);
+%! title ("camroll() demo #1");
 
 %!test
 %! hf = figure ("visible", "off");
--- a/scripts/plot/appearance/camtarget.m	Thu Dec 07 13:47:55 2017 -0800
+++ b/scripts/plot/appearance/camtarget.m	Thu Dec 07 17:37:05 2017 -0800
@@ -118,10 +118,11 @@
 %!demo
 %! clf;
 %! sphere ();
+%! title ("camtarget() demo #1");
 %! ## where is camera pointing?
 %! x1 = camtarget ()
 %! ## point the camera upwards
-%! camtarget (x1 + [0 0 1])
+%! camtarget (x1 + [0 0 1]);
 %! x2 = camtarget ()
 
 %!test
@@ -182,7 +183,7 @@
 %!error <invalid value>
 %! hf = figure ("visible", "off");
 %! unwind_protect
-%!  camtarget ("mod")
+%!  camtarget ("mod");
 %! unwind_protect_cleanup
 %!   delete (hf);
 %! end_unwind_protect
--- a/scripts/plot/appearance/camup.m	Thu Dec 07 13:47:55 2017 -0800
+++ b/scripts/plot/appearance/camup.m	Thu Dec 07 17:37:05 2017 -0800
@@ -113,10 +113,11 @@
 %!demo
 %! clf;
 %! sphere ();
+%! title ("camup() demo #1");
 %! ## what direction is "up" for the camera?
 %! x1 = camup ()
 %! ## re-orient the camera with a new up-vector
-%! camup ([1 0 0])
+%! camup ([1 0 0]);
 %! x2 = camup ()
 
 %!test
--- a/scripts/plot/appearance/camva.m	Thu Dec 07 13:47:55 2017 -0800
+++ b/scripts/plot/appearance/camva.m	Thu Dec 07 17:37:05 2017 -0800
@@ -100,10 +100,11 @@
 %!demo
 %! clf;
 %! peaks ();
+%! title ("camva() demo #1");
 %! ## query the viewing angle
 %! a1 = camva ()
 %! ## get a close-up view by decreasing the viewing angle:
-%! camva (0.5*a1)
+%! camva (0.5*a1);
 %! a2 = camva ()
 
 %!test
--- a/scripts/plot/appearance/camzoom.m	Thu Dec 07 13:47:55 2017 -0800
+++ b/scripts/plot/appearance/camzoom.m	Thu Dec 07 17:37:05 2017 -0800
@@ -84,6 +84,7 @@
 %! clf;
 %! peaks ();
 %! camzoom (2);
+%! title ("camzoom() demo #1");
 
 %!test
 %! hf = figure ("visible", "off");
--- a/scripts/plot/appearance/grid.m	Thu Dec 07 13:47:55 2017 -0800
+++ b/scripts/plot/appearance/grid.m	Thu Dec 07 17:37:05 2017 -0800
@@ -175,10 +175,14 @@
 %!  plot (1:10);
 %!  set (gca, "xminorgrid", "on");
 %!  set (gca, "yminorgrid", "on");
+%!  title ({"major grid disabled",
+%!          "minor grid displayed at major ticks"}); 
 %! subplot (1,2,2)
 %!  semilogy (1:100);
 %!  set (gca, "xminorgrid", "on");
 %!  set (gca, "yminorgrid", "on");
+%!  title ({"major grid disabled",
+%!          "minor grid displayed at major ticks"}); 
 
 %!demo
 %! clf;
--- a/scripts/plot/draw/isocaps.m	Thu Dec 07 13:47:55 2017 -0800
+++ b/scripts/plot/draw/isocaps.m	Thu Dec 07 17:37:05 2017 -0800
@@ -419,7 +419,11 @@
 %!  isocaps (x, yy, z, v, isoval);
 %!  view (3);
 %!
-%! annotation ("textbox", [0.1 0.9 0.9 0.1], ...
+%! annotation ("textbox", [0.41 0.9 0.9 0.1], ...
+%!     "String", "isocaps() called 4 ways", ...
+%!     "HorizontalAlignment", "center", ...
+%!     "FontSize", 12);
+%! annotation ("textbox", [0.1 0.47 0.9 0.1], ...
 %!     "String", ["Apart from the first plot having a different scale, " ...
 %!     "all four plots must look the same."], ...
 %!     "HorizontalAlignment", "left", ...
--- a/scripts/plot/draw/isosurface.m	Thu Dec 07 13:47:55 2017 -0800
+++ b/scripts/plot/draw/isosurface.m	Thu Dec 07 17:37:05 2017 -0800
@@ -378,7 +378,7 @@
 %! isosurface (x, y, z, v, 3);
 %! isosurface (x, y, z, v, 5);
 %! axis equal;
-%! title ("isosurfaces of two nested spheres");
+%! title ("isosurface() of two nested spheres");
 
 %!demo
 %! clf;
@@ -414,7 +414,11 @@
 %!  patch (fvc);
 %!  shading faceted;
 %!  view (110, 40);
-%!  annotation ("textbox", [0.1 0.9 0.9 0.1], ...
+%!  annotation ("textbox", [0.41 0.9 0.9 0.1], ...
+%!      "String", "isosurface() called 4 ways", ...
+%!      "HorizontalAlignment", "center", ...
+%!      "FontSize", 12);
+%!  annotation ("textbox", [0.1 0.45 0.9 0.1], ...
 %!      "String", {["Apart from the first plot having a different scale, " ...
 %!                  "all four plots must look the same."],
 %!                 ["The last plot might have different colors but must " ...
--- a/scripts/plot/draw/pareto.m	Thu Dec 07 13:47:55 2017 -0800
+++ b/scripts/plot/draw/pareto.m	Thu Dec 07 17:37:05 2017 -0800
@@ -122,6 +122,7 @@
 %! Cheese = {"Cheddar", "Swiss", "Camembert", "Munster", "Stilton", "Blue"};
 %! Sold = [105, 30, 70, 10, 15, 20];
 %! pareto (Sold, Cheese);
+%! title ("pareto() demo #1");
 
 %!demo
 %! clf;
@@ -131,3 +132,4 @@
 %! SoldUnits = [54723 41114 16939 1576091 168000 687197 120222 168195, ...
 %!              1084118 55576]';
 %! pareto (Value.*SoldUnits, Codes);
+%! title ("pareto() demo #2");
--- a/scripts/plot/draw/plotmatrix.m	Thu Dec 07 13:47:55 2017 -0800
+++ b/scripts/plot/draw/plotmatrix.m	Thu Dec 07 17:37:05 2017 -0800
@@ -111,6 +111,7 @@
 %!demo
 %! clf;
 %! plotmatrix (randn (100, 3), "g+");
+%! title ("plotmatrix() demo #1");
 
 
 function plotmatrixdelete (h, d, ax)
--- a/scripts/plot/draw/plotyy.m	Thu Dec 07 13:47:55 2017 -0800
+++ b/scripts/plot/draw/plotyy.m	Thu Dec 07 17:37:05 2017 -0800
@@ -305,10 +305,12 @@
 %! x = linspace (-1, 1, 201);
 %! subplot (2,2,1);
 %!  plotyy (x,sin(pi*x), x,10*cos(pi*x));
+%!  title ("plotyy() in subplot");
 %! subplot (2,2,2);
 %!  surf (peaks (25));
 %! subplot (2,2,3);
 %!  contour (peaks (25));
 %! subplot (2,2,4);
 %!  plotyy (x,10*sin(2*pi*x), x,cos(2*pi*x));
+%!  title ("plotyy() in subplot");
 %!  axis square;
--- a/scripts/plot/draw/shrinkfaces.m	Thu Dec 07 13:47:55 2017 -0800
+++ b/scripts/plot/draw/shrinkfaces.m	Thu Dec 07 17:37:05 2017 -0800
@@ -160,6 +160,7 @@
 %! patch (fv);
 %! axis auto;   # Kludge required for Octave
 %! axis equal;
+%! title ("shrinkfaces() on triangular shapes");
 
 %!demo
 %! clf;
@@ -171,6 +172,7 @@
 %! axis auto;   # Kludge required for Octave
 %! axis equal;
 %! grid on;
+%! title ("shrinkfaces() on rhomboid shapes");
 
 %!demo
 %! clf;
@@ -182,7 +184,7 @@
 %! axis auto;   # Kludge required for Octave
 %! axis equal;
 %! grid on;
-%! title "faces which are not convex are clearly not allowed"
+%! title ("shrinkfaces() does not work on concave shapes");
 
 %!demo
 %! clf;
@@ -195,6 +197,7 @@
 %! axis auto;   # Kludge required for Octave
 %! axis equal;
 %! grid on;
+%! title ("shrinkfaces() on 2-D complex shapes tesselated with triangles");
 
 %!demo
 %! clf;
@@ -210,6 +213,7 @@
 %! view (115, 30);
 %! drawnow;
 %! shrinkfaces (p, 0.6);
+%! title ("shrinkfaces() on 3-D complex shapes");
 
 %!shared faces, vertices, nfv, nfv2
 %! faces = [1 2 3];
--- a/scripts/plot/draw/slice.m	Thu Dec 07 13:47:55 2017 -0800
+++ b/scripts/plot/draw/slice.m	Thu Dec 07 17:37:05 2017 -0800
@@ -207,6 +207,7 @@
 %! [x, y, z] = meshgrid (linspace (-8, 8, 32));
 %! v = sin (sqrt (x.^2 + y.^2 + z.^2)) ./ (sqrt (x.^2 + y.^2 + z.^2));
 %! slice (x, y, z, v, [], 0, []);
+%! title ("slice() demo #1");
 
 %!demo
 %! clf;
@@ -216,3 +217,4 @@
 %! [xi, yi] = meshgrid (linspace (-7, 7));
 %! zi = xi + yi;
 %! slice (x, y, z, v, xi, yi, zi);
+%! title ("slice() demo #2");
--- a/scripts/plot/draw/trimesh.m	Thu Dec 07 13:47:55 2017 -0800
+++ b/scripts/plot/draw/trimesh.m	Thu Dec 07 17:37:05 2017 -0800
@@ -111,6 +111,7 @@
 %! z = peaks (x, y);
 %! tri = delaunay (x(:), y(:));
 %! trimesh (tri, x(:), y(:), z(:));
+%! title ("trimesh() plot of sparsely-sampled peaks() function");
 
 ## Test input validation
 %!error trimesh ()
--- a/scripts/plot/draw/triplot.m	Thu Dec 07 13:47:55 2017 -0800
+++ b/scripts/plot/draw/triplot.m	Thu Dec 07 17:37:05 2017 -0800
@@ -63,3 +63,4 @@
 %! y = rand (N, 1);
 %! tri = delaunay (x, y);
 %! triplot (tri, x, y);
+%! title ("triplot() of random 2-D Delaunay triangulation");
--- a/scripts/plot/draw/trisurf.m	Thu Dec 07 13:47:55 2017 -0800
+++ b/scripts/plot/draw/trisurf.m	Thu Dec 07 17:37:05 2017 -0800
@@ -101,10 +101,10 @@
 %! [x, y] = meshgrid (1:N);
 %! tri = delaunay (x(:), y(:));
 %! z = peaks (N);
-%! h = trisurf (tri, x, y, z, "facecolor", "interp");
+%! h = trisurf (tri, x, y, z, "facecolor", "flat");
 %! axis tight;
 %! zlim auto;
-%! title (sprintf ("facecolor = %s", get (h, "facecolor")));
+%! title ({"trisurf() of peaks() function", 'facecolor = "flat"'});
 
 %!demo
 %! clf;
@@ -113,12 +113,10 @@
 %! [x, y] = meshgrid (1:N);
 %! tri = delaunay (x(:), y(:));
 %! z = peaks (N);
-%! h = trisurf (tri, x, y, z, "facecolor", "flat");
+%! h = trisurf (tri, x, y, z, "facecolor", "interp");
 %! axis tight;
 %! zlim auto;
-%! title (sprintf ("facecolor = %s", get (h, "facecolor")));
-
-## FIXME: The demos below should each have a title
+%! title ({"trisurf() of peaks() function", 'facecolor = "interp"'});
 
 %!demo
 %! clf;
@@ -132,6 +130,7 @@
 %! z = peaks (x, y);
 %! tri = delaunay (x(:), y(:));
 %! trisurf (tri, x(:), y(:), z(:));
+%! title ("trisurf() of sparsely-sampled triangulation of peaks()");
 
 %!demo
 %! clf;
@@ -141,6 +140,7 @@
 %! z = x.^2 + y.^2;
 %! tri = delaunay (x, y);
 %! trisurf (tri, x, y, z);
+%! title ({"trisurf() of random data", 'default "facecolor" = "flat", "edgecolor" = "black"'});
 
 %!demo
 %! clf;
@@ -150,6 +150,7 @@
 %! z = x.^2 + y.^2;
 %! tri = delaunay (x, y);
 %! trisurf (tri, x, y, z, "facecolor", "interp");
+%! title ({"trisurf() of random data", '"facecolor" = "interp"'});
 
 %!demo
 %! clf;
@@ -158,7 +159,8 @@
 %! y = rand (100, 1);
 %! z = x.^2 + y.^2;
 %! tri = delaunay (x, y);
-%! trisurf (tri, x, y, z, "facecolor", "interp", "edgecolor", "k");
+%! trisurf (tri, x, y, z, "facecolor", "interp", "edgecolor", "w");
+%! title ({"trisurf() of random data", '"facecolor" = "interp", "edgecolor" = "white"'});
 
 ## Test input validation
 %!error trisurf ()
--- a/scripts/plot/util/axes.m	Thu Dec 07 13:47:55 2017 -0800
+++ b/scripts/plot/util/axes.m	Thu Dec 07 17:37:05 2017 -0800
@@ -124,6 +124,67 @@
 endfunction
 
 
+## FIXME: These demos actually just show how axes objects behave.
+##        They do not show how the axes() function itself works.
+%!demo
+%! clf;
+%! x = -10:10;
+%! plot (x,x, x,-x);
+%! set (gca, "yscale", "log");
+%! legend ({"x >= 1", "x <= 1"}, "location", "north");
+%! title ({"log axes discard negative data", "ylim = [1, 10]"});
+
+%!demo
+%! clf;
+%! x = -10:0.1:10;
+%! y = sin (x)./(1 + abs (x)) + 0.1*x - 0.4;
+%! plot (x, y);
+%! set (gca, "xaxislocation", "origin");
+%! set (gca, "yaxislocation", "origin");
+%! box off;
+%! title ({"no plot box", "xaxislocation = origin, yaxislocation = origin"});
+
+%!demo
+%! clf;
+%! x = -10:0.1:10;
+%! y = sin (x)./(1+abs (x)) + 0.1*x - 0.4;
+%! plot (x, y);
+%! set (gca, "xaxislocation", "origin");
+%! set (gca, "yaxislocation", "left");
+%! box off;
+%! title ({"no plot box", "xaxislocation = origin, yaxislocation = left"});
+
+%!demo
+%! clf;
+%! x = -10:0.1:10;
+%! y = sin (x)./(1+abs (x)) + 0.1*x - 0.4;
+%! plot (x, y);
+%! title ("no plot box");
+%! set (gca, "xaxislocation", "origin");
+%! set (gca, "yaxislocation", "right");
+%! box off;
+%! title ({"no plot box", "xaxislocation = origin, yaxislocation = right"});
+
+%!demo
+%! clf;
+%! x = -10:0.1:10;
+%! y = sin (x)./(1+abs (x)) + 0.1*x - 0.4;
+%! plot (x, y);
+%! set (gca, "xaxislocation", "bottom");
+%! set (gca, "yaxislocation", "origin");
+%! box off;
+%! title ({"no plot box", "xaxislocation = bottom, yaxislocation = origin"});
+
+%!demo
+%! clf;
+%! x = -10:0.1:10;
+%! y = sin (x)./(1+abs (x)) + 0.1*x - 0.4;
+%! plot (x, y);
+%! set (gca, "xaxislocation", "top");
+%! set (gca, "yaxislocation", "origin");
+%! box off;
+%! title ({"no plot box", "xaxislocation = top, yaxislocation = origin"});
+
 %!test
 %! hf = figure ("visible", "off");
 %! unwind_protect
--- a/scripts/plot/util/zoom.m	Thu Dec 07 13:47:55 2017 -0800
+++ b/scripts/plot/util/zoom.m	Thu Dec 07 17:37:05 2017 -0800
@@ -180,6 +180,7 @@
 %!demo
 %! clf;
 %! sombrero ();
+%! title ("zoom() demo #1");
 %! pause (1);
 %! ## zoom in by a factor of 2
 %! zoom (2);