changeset 20724:0338dc274ec5

Rewrite colormap demos with rgbplot() to show both composite and profile. * scripts/image/autumn.m, scripts/image/bone.m, scripts/image/cool.m, scripts/image/copper.m, scripts/image/cubehelix.m, scripts/image/gray.m, scripts/image/hot.m, scripts/image/hsv.m, scripts/image/jet.m, scripts/image/ocean.m, scripts/image/pink.m, scripts/image/rainbow.m, scripts/image/spring.m, scripts/image/summer.m, scripts/image/viridis.m, scripts/image/white.m, scripts/image/winter.m: rewrite the demos to make use of rgbplot instead of manually creating the composite view. Also expand it to include the rgb profile of the colormap under the composite view to better understand the colormap. Expand the number of colours in the demo to 256 for smoother curves. * scripts/image/flag.m, scripts/image/lines.m, scripts/image/prism.m: same as above but since these are periodic colormaps, change the default length to show 3 cycles.
author Carnë Draug <carandraug@octave.org>
date Thu, 19 Nov 2015 17:09:06 +0000
parents 7581021c5ca3
children 7164a69472dd
files scripts/image/autumn.m scripts/image/bone.m scripts/image/cool.m scripts/image/copper.m scripts/image/cubehelix.m scripts/image/flag.m scripts/image/gray.m scripts/image/hot.m scripts/image/hsv.m scripts/image/jet.m scripts/image/lines.m scripts/image/ocean.m scripts/image/pink.m scripts/image/prism.m scripts/image/rainbow.m scripts/image/spring.m scripts/image/summer.m scripts/image/viridis.m scripts/image/white.m scripts/image/winter.m
diffstat 20 files changed, 124 insertions(+), 99 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/image/autumn.m	Thu Nov 19 17:05:36 2015 +0000
+++ b/scripts/image/autumn.m	Thu Nov 19 17:09:06 2015 +0000
@@ -56,8 +56,9 @@
 
 
 %!demo
-%! ## Show the 'autumn' colormap as an image
-%! image (1:64, linspace (0, 1, 64), repmat ((1:64)', 1, 64));
-%! axis ([1, 64, 0, 1], "ticy", "xy");
-%! colormap (autumn (64));
-
+%! ## Show the 'autumn' colormap profile and as an image
+%! cmap = autumn (256);
+%! subplot (2, 1, 1);
+%! rgbplot (cmap, "composite");
+%! subplot (2, 1, 2);
+%! rgbplot (cmap);
--- a/scripts/image/bone.m	Thu Nov 19 17:05:36 2015 +0000
+++ b/scripts/image/bone.m	Thu Nov 19 17:09:06 2015 +0000
@@ -83,8 +83,9 @@
 
 
 %!demo
-%! ## Show the 'bone' colormap as an image
-%! image (1:64, linspace (0, 1, 64), repmat ((1:64)', 1, 64));
-%! axis ([1, 64, 0, 1], "ticy", "xy");
-%! colormap (bone (64));
-
+%! ## Show the 'bone' colormap profile and as an image
+%! cmap = bone (256);
+%! subplot (2, 1, 1);
+%! rgbplot (cmap, "composite");
+%! subplot (2, 1, 2);
+%! rgbplot (cmap);
--- a/scripts/image/cool.m	Thu Nov 19 17:05:36 2015 +0000
+++ b/scripts/image/cool.m	Thu Nov 19 17:09:06 2015 +0000
@@ -55,8 +55,9 @@
 
 
 %!demo
-%! ## Show the 'cool' colormap as an image
-%! image (1:64, linspace (0, 1, 64), repmat ((1:64)', 1, 64));
-%! axis ([1, 64, 0, 1], "ticy", "xy");
-%! colormap (cool (64));
-
+%! ## Show the 'cool' colormap profile and as an image
+%! cmap = cool (256);
+%! subplot (2, 1, 1);
+%! rgbplot (cmap, "composite");
+%! subplot (2, 1, 2);
+%! rgbplot (cmap);
--- a/scripts/image/copper.m	Thu Nov 19 17:05:36 2015 +0000
+++ b/scripts/image/copper.m	Thu Nov 19 17:09:06 2015 +0000
@@ -58,8 +58,9 @@
 
 
 %!demo
-%! ## Show the 'copper' colormap as an image
-%! image (1:64, linspace (0, 1, 64), repmat ((1:64)', 1, 64));
-%! axis ([1, 64, 0, 1], "ticy", "xy");
-%! colormap (copper (64));
-
+%! ## Show the 'copper' colormap profile and as an image
+%! cmap = copper (256);
+%! subplot (2, 1, 1);
+%! rgbplot (cmap, "composite");
+%! subplot (2, 1, 2);
+%! rgbplot (cmap);
--- a/scripts/image/cubehelix.m	Thu Nov 19 17:05:36 2015 +0000
+++ b/scripts/image/cubehelix.m	Thu Nov 19 17:09:06 2015 +0000
@@ -79,9 +79,12 @@
 endfunction
 
 
+## A better demo of this colormap would be a 3d plot in ntsc instead of
+## rgb values.  That would really show what this colormap is about.
 %!demo
-%! subplot (1, 2, 1)
-%! rgbplot (cubehelix (256), "composite")
-%! subplot (1, 2, 2)
-%! rgbplot (cubehelix (256))
-
+%! ## Show the 'cubehelix' colormap profile and as an image
+%! cmap = cubehelix (256);
+%! subplot (2, 1, 1);
+%! rgbplot (cmap, "composite");
+%! subplot (2, 1, 2);
+%! rgbplot (cmap);
--- a/scripts/image/flag.m	Thu Nov 19 17:05:36 2015 +0000
+++ b/scripts/image/flag.m	Thu Nov 19 17:09:06 2015 +0000
@@ -53,8 +53,9 @@
 
 
 %!demo
-%! ## Show the 'flag' colormap as an image
-%! image (1:64, linspace (0, 1, 64), repmat ((1:64)', 1, 64));
-%! axis ([1, 64, 0, 1], "ticy", "xy");
-%! colormap (flag (64));
-
+%! ## Show the 'flag' colormap profile and as an image
+%! cmap = flag (12);  # 4 colours, therefore cycle 3 times
+%! subplot (2, 1, 1);
+%! rgbplot (cmap, "composite");
+%! subplot (2, 1, 2);
+%! rgbplot (cmap);
--- a/scripts/image/gray.m	Thu Nov 19 17:05:36 2015 +0000
+++ b/scripts/image/gray.m	Thu Nov 19 17:09:06 2015 +0000
@@ -56,8 +56,9 @@
 
 
 %!demo
-%! ## Show the 'gray' colormap as an image
-%! image (1:64, linspace (0, 1, 64), repmat ((1:64)', 1, 64));
-%! axis ([1, 64, 0, 1], "ticy", "xy");
-%! colormap (gray (64));
-
+%! ## Show the 'gray' colormap profile and as an image
+%! cmap = gray (16);
+%! subplot (2, 1, 1);
+%! rgbplot (cmap, "composite");
+%! subplot (2, 1, 2);
+%! rgbplot (cmap);
--- a/scripts/image/hot.m	Thu Nov 19 17:05:36 2015 +0000
+++ b/scripts/image/hot.m	Thu Nov 19 17:09:06 2015 +0000
@@ -71,8 +71,9 @@
 
 
 %!demo
-%! ## Show the 'hot' colormap as an image
-%! image (1:64, linspace (0, 1, 64), repmat ((1:64)', 1, 64));
-%! axis ([1, 64, 0, 1], "ticy", "xy");
-%! colormap (hot (64));
-
+%! ## Show the 'hot' colormap profile and as an image
+%! cmap = hot (256);
+%! subplot (2, 1, 1);
+%! rgbplot (cmap, "composite");
+%! subplot (2, 1, 2);
+%! rgbplot (cmap);
--- a/scripts/image/hsv.m	Thu Nov 19 17:05:36 2015 +0000
+++ b/scripts/image/hsv.m	Thu Nov 19 17:09:06 2015 +0000
@@ -57,9 +57,11 @@
 endfunction
 
 
+## A better demo of this colormap would be to plot the hsv values.
 %!demo
-%! ## Show the 'hsv' colormap as an image
-%! image (1:64, linspace (0, 1, 64), repmat ((1:64)', 1, 64));
-%! axis ([1, 64, 0, 1], "ticy", "xy");
-%! colormap (hsv (64));
-
+%! ## Show the 'hsv' colormap profile and as an image
+%! cmap = hsv (256);
+%! subplot (2, 1, 1);
+%! rgbplot (cmap, "composite");
+%! subplot (2, 1, 2);
+%! rgbplot (cmap);
--- a/scripts/image/jet.m	Thu Nov 19 17:05:36 2015 +0000
+++ b/scripts/image/jet.m	Thu Nov 19 17:09:06 2015 +0000
@@ -90,8 +90,9 @@
 
 
 %!demo
-%! ## Show the 'jet' colormap as an image
-%! image (1:64, linspace (0, 1, 64), repmat ((1:64)', 1, 64));
-%! axis ([1, 64, 0, 1], "ticy", "xy");
-%! colormap (jet (64));
-
+%! ## Show the 'jet' colormap profile and as an image
+%! cmap = jet (256);
+%! subplot (2, 1, 1);
+%! rgbplot (cmap, "composite");
+%! subplot (2, 1, 2);
+%! rgbplot (cmap);
--- a/scripts/image/lines.m	Thu Nov 19 17:05:36 2015 +0000
+++ b/scripts/image/lines.m	Thu Nov 19 17:09:06 2015 +0000
@@ -53,8 +53,9 @@
 
 
 %!demo
-%! ## Show the 'lines' colormap as an image
-%! image (1:64, linspace (0, 1, 64), repmat ((1:64)', 1, 64));
-%! axis ([1, 64, 0, 1], "ticy", "xy");
-%! colormap (lines (64));
-
+%! ## Show the 'lines' colormap profile and as an image
+%! cmap = lines (21); # default has 7 colours, therefore cycle 3 times
+%! subplot (2, 1, 1);
+%! rgbplot (cmap, "composite");
+%! subplot (2, 1, 2);
+%! rgbplot (cmap);
--- a/scripts/image/ocean.m	Thu Nov 19 17:05:36 2015 +0000
+++ b/scripts/image/ocean.m	Thu Nov 19 17:09:06 2015 +0000
@@ -65,8 +65,9 @@
 
 
 %!demo
-%! ## Show the 'ocean' colormap as an image
-%! image (1:64, linspace (0, 1, 64), repmat ((1:64)', 1, 64));
-%! axis ([1, 64, 0, 1], "ticy", "xy");
-%! colormap (ocean (64));
-
+%! ## Show the 'ocean' colormap profile and as an image
+%! cmap = ocean (256);
+%! subplot (2, 1, 1);
+%! rgbplot (cmap, "composite");
+%! subplot (2, 1, 2);
+%! rgbplot (cmap);
--- a/scripts/image/pink.m	Thu Nov 19 17:05:36 2015 +0000
+++ b/scripts/image/pink.m	Thu Nov 19 17:09:06 2015 +0000
@@ -73,8 +73,9 @@
 
 
 %!demo
-%! ## Show the 'pink' colormap as an image
-%! image (1:64, linspace (0, 1, 64), repmat ((1:64)', 1, 64));
-%! axis ([1, 64, 0, 1], "ticy", "xy");
-%! colormap (pink (64));
-
+%! ## Show the 'pink' colormap profile and as an image
+%! cmap = pink (256);
+%! subplot (2, 1, 1);
+%! rgbplot (cmap, "composite");
+%! subplot (2, 1, 2);
+%! rgbplot (cmap);
--- a/scripts/image/prism.m	Thu Nov 19 17:05:36 2015 +0000
+++ b/scripts/image/prism.m	Thu Nov 19 17:09:06 2015 +0000
@@ -53,8 +53,9 @@
 
 
 %!demo
-%! ## Show the 'prism' colormap as an image
-%! image (1:64, linspace (0, 1, 64), repmat ((1:64)', 1, 64));
-%! axis ([1, 64, 0, 1], "ticy", "xy");
-%! colormap (prism (64));
-
+%! ## Show the 'prism' colormap profile and as an image
+%! cmap = prism (18); # 6 colours, therefore cycle 3 times
+%! subplot (2, 1, 1);
+%! rgbplot (cmap, "composite");
+%! subplot (2, 1, 2);
+%! rgbplot (cmap);
--- a/scripts/image/rainbow.m	Thu Nov 19 17:05:36 2015 +0000
+++ b/scripts/image/rainbow.m	Thu Nov 19 17:09:06 2015 +0000
@@ -69,8 +69,9 @@
 
 
 %!demo
-%! ## Show the 'rainbow' colormap as an image
-%! image (1:64, linspace (0, 1, 64), repmat ((1:64)', 1, 64));
-%! axis ([1, 64, 0, 1], "ticy", "xy");
-%! colormap (rainbow (64));
-
+%! ## Show the 'rainbow' colormap profile and as an image
+%! cmap = rainbow (256);
+%! subplot (2, 1, 1);
+%! rgbplot (cmap, "composite");
+%! subplot (2, 1, 2);
+%! rgbplot (cmap);
--- a/scripts/image/spring.m	Thu Nov 19 17:05:36 2015 +0000
+++ b/scripts/image/spring.m	Thu Nov 19 17:09:06 2015 +0000
@@ -55,8 +55,9 @@
 
 
 %!demo
-%! ## Show the 'spring' colormap as an image
-%! image (1:64, linspace (0, 1, 64), repmat ((1:64)', 1, 64));
-%! axis ([1, 64, 0, 1], "ticy", "xy");
-%! colormap (spring (64));
-
+%! ## Show the 'spring' colormap profile and as an image
+%! cmap = spring (256);
+%! subplot (2, 1, 1);
+%! rgbplot (cmap, "composite");
+%! subplot (2, 1, 2);
+%! rgbplot (cmap);
--- a/scripts/image/summer.m	Thu Nov 19 17:05:36 2015 +0000
+++ b/scripts/image/summer.m	Thu Nov 19 17:09:06 2015 +0000
@@ -56,8 +56,9 @@
 
 
 %!demo
-%! ## Show the 'summer' colormap as an image
-%! image (1:64, linspace (0, 1, 64), repmat ((1:64)', 1, 64));
-%! axis ([1, 64, 0, 1], "ticy", "xy");
-%! colormap (summer (64));
-
+%! ## Show the 'summer' colormap profile and as an image
+%! cmap = summer (256);
+%! subplot (2, 1, 1);
+%! rgbplot (cmap, "composite");
+%! subplot (2, 1, 2);
+%! rgbplot (cmap);
--- a/scripts/image/viridis.m	Thu Nov 19 17:05:36 2015 +0000
+++ b/scripts/image/viridis.m	Thu Nov 19 17:09:06 2015 +0000
@@ -309,8 +309,11 @@
 
 endfunction
 
+## A better demo of this colormap would be to plot the CIECAM02 values.
 %!demo
-%! ## Show the 'viridis' colormap as an image
-%! image (1:256, linspace (0, 1, 256), repmat ((1:256)', 1, 256));
-%! axis ([1, 256, 0, 1], "ticy", "xy");
-%! colormap (viridis (256));
+%! ## Show the 'viridis' colormap profile and as an image
+%! cmap = viridis (256);
+%! subplot (2, 1, 1);
+%! rgbplot (cmap, "composite");
+%! subplot (2, 1, 2);
+%! rgbplot (cmap);
--- a/scripts/image/white.m	Thu Nov 19 17:05:36 2015 +0000
+++ b/scripts/image/white.m	Thu Nov 19 17:09:06 2015 +0000
@@ -45,8 +45,9 @@
 
 
 %!demo
-%! ## Show the 'white' colormap as an image
-%! image (1:64, linspace (0, 1, 64), repmat ((1:64)', 1, 64));
-%! axis ([1, 64, 0, 1], "ticy", "xy");
-%! colormap (white (64));
-
+%! ## Show the 'white' colormap profile and as an image
+%! cmap = white (256);
+%! subplot (2, 1, 1);
+%! rgbplot (cmap, "composite");
+%! subplot (2, 1, 2);
+%! rgbplot (cmap);
--- a/scripts/image/winter.m	Thu Nov 19 17:05:36 2015 +0000
+++ b/scripts/image/winter.m	Thu Nov 19 17:09:06 2015 +0000
@@ -55,8 +55,9 @@
 
 
 %!demo
-%! ## Show the 'winter' colormap as an image
-%! image (1:64, linspace (0, 1, 64), repmat ((1:64)', 1, 64));
-%! axis ([1, 64, 0, 1], "ticy", "xy");
-%! colormap (winter (64));
-
+%! ## Show the 'winter' colormap profile and as an image
+%! cmap = winter (256);
+%! subplot (2, 1, 1);
+%! rgbplot (cmap, "composite");
+%! subplot (2, 1, 2);
+%! rgbplot (cmap);