axis manipulations in plots are unnecessarily restrictive

Rob Mahurin rob at utk.edu
Thu Mar 6 10:41:28 CST 2008


Bug report for Octave 3.0.0 configured for x86_64-unknown-linux-gnu

Description:
-----------

The change to "graphics handle" plot manipulation has made some  
tweaks to gnuplot's default axes impossible.  I have (somewhat)  
rewritten them in the new language and would be glad to see them  
officially supported in a later version of Octave.

Eventually I will probably write Octave code to produce the dot-dash- 
frame and range-frame plots from Tufte's "Visual Display of  
Quantitative Information," for which these modifications are necessary.

Repeat-By:
---------

This is a wishlist bug, with a partial patch.

	plot(anything);
	# eliminate the box, but keep the tics
	set(gca,"visible","ticks");
	# eliminate the tics, but keep the box
	set(gca,"visible","lines");
	# these are already implemented
	set(gca,"visible","off");
	set(gca,"visible","on");

A statement like
	set(gca,"thickness",0);
should send "set border lw 0;\n" to the gnuplot backend.

It should be possible to use produce formatted ticklabels, e.g.	
	set(gca,"xticklabels","%.3f");
Until Octave implements this, the backend's formatting options should  
be available.

Fix:
---

I don't know where to add handle members like "thickness" or  
"formatlabels" to make those two changes optional: set() correctly  
refuses to add new members.

--- __go_draw_axes__.m~   2008-02-28 18:56:37.000000000 -0700
+++ __go_draw_axes__.m    2008-03-04 13:19:07.000000000 -0700
@@ -1079,8 +1079,13 @@
        endif
      endif

+    fputs (plot_stream, "set border lw 0\n");
      if (strcmpi (axis_obj.visible, "off"))
        fputs (plot_stream, "unset border; unset tics\n");
+    elseif (strcmpi (axis_obj.visible, "ticks"))
+      fputs (plot_stream, "unset border; set tics out\n");
+    elseif (strcmpi (axis_obj.visible, "lines"))
+      fputs (plot_stream, "unset tics\n");
      endif

      if (strcmpi (axis_obj.key, "on"))
@@ -1530,7 +1535,7 @@
         else
           fprintf (plot_stream, "set %stics %s nomirror (", ax,  
axispos);
         endif
-       labels = regexprep(labels, "%", "%%");
+###    labels = regexprep(labels, "%", "%%");
         for i = 1:ntics
           fprintf (plot_stream, " \"%s\" %g", labels{k++}, tics(i))
           if (i < ntics)


-- 
Rob Mahurin
Dept. of Physics & Astronomy
University of Tennessee 	phone: 865 207 2594
Knoxville, TN 37996     	email: rob at utk.edu



More information about the Bug-octave mailing list