# HG changeset patch # User Ben Abbott # Date 1316477927 14400 # Node ID 9efb676b34ac0e45bc9d48c75d9312f74fb4681e # Parent 6b6d0e51bd2f3f23d796ab9291bd672ca4cab724 Fix bug #34015. Allow for sequential images. * scripts/plot/__go_draw_axes__.m: Fix for sequential images. * scripts/plot/image.m: Add demos. diff --git a/scripts/image/image.m b/scripts/image/image.m --- a/scripts/image/image.m +++ b/scripts/image/image.m @@ -164,6 +164,7 @@ endfunction %!demo +%! clf %! img = 1 ./ hilb (11); %! x = -5:5; %! y = x; @@ -186,4 +187,40 @@ %! set (h, "cdatamapping", "scaled") %! title ('image (-x, -y, img)') +%!demo +%! clf +%! g = 0.1:0.1:10; +%! h = g'*g; +%! imagesc (g, g, sin (h)); +%! hold on +%! imagesc (g, g+12, cos (h/2)); +%! axis ([0 10 0 22]) +%! hold off +%! title ("two consecutive images") +%!demo +%! clf +%! g = 0.1:0.1:10; +%! h = g'*g; +%! imagesc (g, g, sin (h)); +%! hold all +%! plot (g, 11.0 * ones (size (g))) +%! imagesc (g, g+12, cos (h/2)); +%! axis ([0 10 0 22]) +%! hold off +%! title ("image, line, image") + +%!demo +%! clf +%! g = 0.1:0.1:10; +%! h = g'*g; +%! plot (g, 10.5 * ones (size (g))) +%! hold all +%! imagesc (g, g, sin (h)); +%! plot (g, 11.0 * ones (size (g))) +%! imagesc (g, g+12, cos (h/2)); +%! plot (g, 11.5 * ones (size (g))) +%! axis ([0 10 0 22]) +%! hold off +%! title ("line, image, line, image, line") + diff --git a/scripts/plot/__go_draw_axes__.m b/scripts/plot/__go_draw_axes__.m --- a/scripts/plot/__go_draw_axes__.m +++ b/scripts/plot/__go_draw_axes__.m @@ -1521,6 +1521,13 @@ fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", plot_cmd, usingclause{1}, titlespec{1}, withclause{1}); elseif (is_image_data (1)) + if (numel (is_image_data) > 1 && is_image_data(2)) + ## Remove terminating semicolon + n = max (strfind (withclause{1}, ";")); + if (! isempty(n)) + withclause{1} = withclause{1}(1:n-1); + endif + endif fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", plot_cmd, usingclause{1}, titlespec{1}, withclause{1}); else @@ -1542,9 +1549,20 @@ fputs (plot_stream, "unset obj 2; \\\n"); fg_is_set = false; endif + if (numel (is_image_data) > i && is_image_data(i+1)) + ## Remove terminating semicolon + n = max (strfind (withclause{i}, ";")); + if (! isempty(n)) + withclause{i} = withclause{i}(1:n-1); + endif + endif + fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", plot_cmd, + usingclause{i}, titlespec{i}, withclause{i}); + else + ## For consecutive images continue with the same plot command + fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", ",", + usingclause{i}, titlespec{i}, withclause{i}); endif - fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", plot_cmd, - usingclause{i}, titlespec{i}, withclause{i}); elseif (is_image_data (i-1)) if (bg_is_set) fputs (plot_stream, "unset obj 1; \\\n");