changeset 13106:c7512d0d52e8 stable

src/graphics.cc: Ensure tick separation is in factors of 10 for log plots. Bug #34207.
author Ben Abbott <bpabbott@mac.com>
date Tue, 06 Sep 2011 14:30:39 -0400
parents 8b7e6f359cee
children 8e61aa0fac77
files src/graphics.cc
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/graphics.cc
+++ b/src/graphics.cc
@@ -5123,6 +5123,13 @@
 
   double tick_sep = calc_tick_sep (lo , hi);
 
+  if (is_logscale && ! (xisinf (hi) || xisinf (lo)))
+    {
+      // FIXME - what if (hi-lo) < tick_sep?
+      //         ex: loglog ([1 1.1])
+      tick_sep = std::ceil (tick_sep, 1.);
+    }
+
   int i1 = static_cast<int> (gnulib::floor (lo / tick_sep));
   int i2 = static_cast<int> (std::ceil (hi / tick_sep));