changeset 18924:9a5e03801d23

Update some plot %!demos so that they run under Matlab. * datetick.m: Explicitly name 'x' axis in call to datetick. * mesh.m: Use try/catch around block checking __graphics_toolkit__ which is an Octave-only figure property. * patch.m: Call patch with X,Y,C rather than X,Y,PROP,VAL which is not supported by Matlab. * ezplot3: Use explicit call to legend, rather than ';legend;' in ezplot3 call which is Octave-only syntax. * rose.m: Add a demo that Matlab can run. Matlab won't run the second demo which uses Octave-only syntax. * copyobj.m: Don't use errorbar plot style argument which is Octave-only syntax.
author Rik <rik@octave.org>
date Mon, 14 Jul 2014 21:40:28 -0700
parents d0d0858cfab1
children 87324260043d
files scripts/plot/appearance/datetick.m scripts/plot/draw/mesh.m scripts/plot/draw/patch.m scripts/plot/draw/plot3.m scripts/plot/draw/rose.m scripts/plot/util/copyobj.m
diffstat 6 files changed, 19 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/appearance/datetick.m	Mon Jul 14 08:54:45 2014 -0700
+++ b/scripts/plot/appearance/datetick.m	Mon Jul 14 21:40:28 2014 -0700
@@ -78,7 +78,7 @@
 %! ylabel ('average price');
 %! ax = gca;
 %! set (ax, 'xtick', datenum (1990:5:2005,1,1));
-%! datetick (2, 'keepticks');
+%! datetick (2, 'x', 'keepticks');
 %! set (ax, 'ytick', 12:16);
 
 ## Remove from test statistics.  No real tests possible.
--- a/scripts/plot/draw/mesh.m	Mon Jul 14 08:54:45 2014 -0700
+++ b/scripts/plot/draw/mesh.m	Mon Jul 14 21:40:28 2014 -0700
@@ -126,9 +126,12 @@
 %! ylabel 'Y-axis';
 %! zlabel 'log scale';
 %! title ({'mesh() with color proportional to Z^2', 'Z-axis is log scale'});
-%! if (strcmp (get (gcf, '__graphics_toolkit__'), 'gnuplot'))
-%!   title ({'Gnuplot: mesh color is wrong', 'This is a Gnuplot bug'});
-%! endif
+%! try
+%!   if (strcmp (get (gcf, '__graphics_toolkit__'), 'gnuplot'))
+%!     title ({'Gnuplot: mesh color is wrong', 'This is a Gnuplot bug'});
+%!   endif
+%! catch
+%! end
 
 %!demo
 %! clf;
--- a/scripts/plot/draw/patch.m	Mon Jul 14 08:54:45 2014 -0700
+++ b/scripts/plot/draw/patch.m	Mon Jul 14 21:40:28 2014 -0700
@@ -235,7 +235,7 @@
 %! colormap (jet (64));
 %! x = [ 0 0; 1 1; 1 0 ];
 %! y = [ 0 0; 0 1; 1 1 ];
-%! p = patch (x, y, 'facecolor', 'b');
+%! p = patch (x, y, 'b');
 %! set (p, 'cdatamapping', 'direct', 'facecolor', 'flat', 'cdata', [1 32]);
 %! title ('Direct mapping of colors: Light-Green UL and Blue LR triangles');
 
--- a/scripts/plot/draw/plot3.m	Mon Jul 14 08:54:45 2014 -0700
+++ b/scripts/plot/draw/plot3.m	Mon Jul 14 21:40:28 2014 -0700
@@ -377,12 +377,14 @@
 %!demo
 %! clf;
 %! z = [0:0.05:5];
-%! plot3 (cos (2*pi*z), sin (2*pi*z), z, ';helix;');
+%! plot3 (cos (2*pi*z), sin (2*pi*z), z)
+%! legend ('helix');
 %! title ('plot3() of a helix');
 
 %!demo
 %! clf;
 %! z = [0:0.05:5];
-%! plot3 (z, exp (2i*pi*z), ';complex sinusoid;');
+%! plot3 (z, exp (2i*pi*z));
+%! legend ('complex sinusoid');
 %! title ('plot3() with complex input');
 
--- a/scripts/plot/draw/rose.m	Mon Jul 14 08:54:45 2014 -0700
+++ b/scripts/plot/draw/rose.m	Mon Jul 14 21:40:28 2014 -0700
@@ -116,6 +116,11 @@
 
 %!demo
 %! clf;
+%! rose (2*randn (1e5, 1), 8);
+%! title ('rose() angular histogram plot with 8 bins');
+
+%!demo
+%! clf;
 %! rose ([2*randn(1e5, 1), pi + 2*randn(1e5, 1)]);
-%! title ('rose() angular histogram plot');
+%! title ('rose() angular histogram plot with 2 data series');
 
--- a/scripts/plot/util/copyobj.m	Mon Jul 14 08:54:45 2014 -0700
+++ b/scripts/plot/util/copyobj.m	Mon Jul 14 21:40:28 2014 -0700
@@ -82,7 +82,7 @@
 %! y = x.^2;
 %! dy = 2 * (.2 * x);
 %! y2 = (x - 3).^2;
-%! hg = errorbar (x, y, dy,'#~');
+%! hg = errorbar (x, y, dy);
 %! set (hg, 'marker', '^', 'markerfacecolor', rand (1,3));
 %! plot (x, y2, 'ok-');
 %! legend ('errorbar', 'line');