changeset 22513:12ea89cb1237

Correct gnuplot toolkit color processing for patch edgecolor (bug #49108) * __gnuplot_draw_axes__.m: Test whether color data is row triad rather than simply three elements. If the patch uses flat, scaled color data mapping, translate color data to palette index. Similarly, if interpreted, non-direct mapping is used, translate to palette index. Range limit color data in both cases.
author Daniel J Sebald <daniel.sebald@ieee.org>
date Sun, 18 Sep 2016 11:15:28 -0500
parents 549f8625a61b
children 1e007e986396
files scripts/plot/util/private/__gnuplot_draw_axes__.m
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/util/private/__gnuplot_draw_axes__.m	Fri Sep 16 20:40:27 2016 -0700
+++ b/scripts/plot/util/private/__gnuplot_draw_axes__.m	Sun Sep 18 11:15:28 2016 -0500
@@ -932,9 +932,13 @@
                   ccol = cdat;
                 endif
                 if (strcmp (ec, "flat"))
-                  if (numel (ccol) == 3)
+                  if (isequal (size (ccol), [1, 3]))
                     color = ccol;
                   else
+                    if (strcmp (obj.cdatamapping, "scaled"))
+                      ccol = 1 + fix (cmap_sz*(ccol-clim(1))/(clim(2)-clim(1)));
+                    endif
+                    ccol = max (1, min (ccol, cmap_sz));
                     if (isscalar (ccol))
                       ccol = repmat (ccol, numel (xcol), 1);
                     endif
@@ -952,6 +956,12 @@
                     color = "interp";
                     have_cdata(data_idx) = true;
                   endif
+                  if (strcmp (obj.cdatamapping, "direct"))
+                    ccol = round (ccol);
+                  else
+                    ccol = 1 + fix (cmap_sz*(ccol-clim(1))/(clim(2)-clim(1)));
+                  endif
+                  ccol = max (1, min (ccol, cmap_sz));
                 endif
               elseif (isnumeric (ec))
                 color = ec;