changeset 21810:1b5285c20e0e stable

Create valid gnuplot commands even for single-entry colormaps (bug #48083). * __go_draw_axes__.m: If the colourmap is a singleton, then replace it by one with two identical colours.
author Lachlan Andrew <lachlanbis@gmail.com>
date Thu, 02 Jun 2016 18:10:05 +1000
parents 4950810ce605
children 25c8d554af32 e56ba70108d3
files scripts/plot/util/private/__go_draw_axes__.m
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/util/private/__go_draw_axes__.m	Thu Jun 02 09:03:05 2016 -0700
+++ b/scripts/plot/util/private/__go_draw_axes__.m	Thu Jun 02 18:10:05 2016 +1000
@@ -1632,6 +1632,10 @@
 
   cmap = [cmap; addedcmap];
   cmap_sz = cmap_sz + rows (addedcmap);
+  if (cmap_sz == 1)        # bug #48083, illegal one-element colormap
+    cmap = [cmap; cmap];
+    cmap_sz = 2;
+  endif
   if (mono == false && length (cmap) > 0)
     fprintf (plot_stream,
              "set palette positive color model RGB maxcolors %i;\n",