changeset 20645:10704158315e

Plot errorbar correctly for just a single point (bug #46165). * __errplot__.m: If calculated bar width is 0, substitute 0.1.
author Rik <rik@octave.org>
date Thu, 22 Oct 2015 21:34:51 -0700
parents 3e449f43e708
children fb0f233d7780
files scripts/plot/draw/private/__errplot__.m
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/draw/private/__errplot__.m	Wed Oct 21 20:36:17 2015 +0200
+++ b/scripts/plot/draw/private/__errplot__.m	Thu Oct 22 21:34:51 2015 -0700
@@ -285,6 +285,9 @@
                                          xscale, yscale)
   if (strcmp (xscale, "linear"))
     dx = 0.01 * (max (xdata(:)) - min (xdata(:)));
+    if (dx == 0)
+      dx = .1;
+    endif
     xlo = xdata - dx;
     xhi = xdata + dx;
   else
@@ -299,6 +302,9 @@
   endif
   if (strcmp (yscale, "linear"))
     dy = 0.01 * (max (ydata(:)) - min (ydata(:)));
+    if (dy == 0)
+      dy = .1;
+    endif
     ylo = ydata - dy;
     yhi = ydata + dy;
   else