diff src/graphics.cc @ 12126:85f9a5b211fd

restructuring draw_axes, enabling minor ticks/grid in fltk, closing bug 31800
author Konstantinos Poulios <logari81@googlemail.com>
date Sat, 22 Jan 2011 11:20:08 +0100
parents 62b7ea59a6ff
children 0b9c1a7e350a
line wrap: on
line diff
--- a/src/graphics.cc	Thu Jan 20 11:10:27 2011 +0100
+++ b/src/graphics.cc	Sat Jan 22 11:20:08 2011 +0100
@@ -4371,6 +4371,7 @@
 void
 axes::properties::calc_ticks_and_lims (array_property& lims,
                                        array_property& ticks,
+                                       array_property& mticks,
                                        bool limmode_is_auto, bool is_logscale)
 {
   // FIXME -- add log ticks and lims
@@ -4432,6 +4433,19 @@
     }
 
   ticks = tmp_ticks;
+
+  int n = is_logscale ? 9 : 4;
+  Matrix tmp_mticks (1, n * tmp_ticks.numel ());
+
+  for (int i = 0; i < tmp_ticks.numel ()-1; i++)
+    {
+      double d = (tmp_ticks (i+1) - tmp_ticks (i)) / (n+1);
+      for (int j = 0; j < n; j++)
+        {
+          tmp_mticks (n*i+j) = tmp_ticks (i) + d * (j+1);
+        }
+    }
+  mticks = tmp_mticks;
 }
 
 void