octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Addition of log base n plotting.


From: Peter Gustafson
Subject: Addition of log base n plotting.
Date: Fri, 10 Aug 2007 17:17:31 -0400
User-agent: Thunderbird 2.0.0.6 (X11/20070806)

Hi, attached is a patch for the gnuplot backend which extends the
[xyz]scale log plotting to include alternate bases.  I don't believe
this capability exists in matlab so I did the following.

When [xyz]scale="log", the axis is plotted in log base 10
When [xyz]scale="logn", the axis is plotted in log base n

Please consider adding it.  Thanks,

Pete

2007-08-10  Peter A. Gustafson  <address@hidden>

        * plot/__go_draw_axes__.m: log base n plots created when
        [xyz]scale="logn"
Index: scripts/plot/__go_draw_axes__.m
===================================================================
RCS file: /cvs/octave/scripts/plot/__go_draw_axes__.m,v
retrieving revision 1.33
diff -c -r1.33 __go_draw_axes__.m
*** scripts/plot/__go_draw_axes__.m     10 Aug 2007 18:41:33 -0000      1.33
--- scripts/plot/__go_draw_axes__.m     10 Aug 2007 21:08:18 -0000
***************
*** 173,195 ****
  
      do_tics (axis_obj, plot_stream);
  
!     xlogscale = strcmpi (axis_obj.xscale, "log");
      if (xlogscale)
!       fprintf (plot_stream, "set logscale %s;\n", xaxisloc);
      else
        fprintf (plot_stream, "unset logscale %s;\n", xaxisloc);
      endif
  
!     ylogscale = strcmpi (axis_obj.yscale, "log");
      if (ylogscale)
!       fprintf (plot_stream, "set logscale %s;\n", yaxisloc);
      else
        fprintf (plot_stream, "unset logscale %s;\n", yaxisloc);
      endif
  
!     zlogscale = strcmpi (axis_obj.zscale, "log");
      if (zlogscale)
!       fputs (plot_stream, "set logscale z;\n");
      else
        fputs (plot_stream, "unset logscale z;\n");
      endif
--- 173,213 ----
  
      do_tics (axis_obj, plot_stream);
  
!     xlogscale = strcmpi (axis_obj.xscale(1:3), "log");
      if (xlogscale)
!       xscalel = length(axis_obj.xscale);
!       if (xscalel > 3)
!       base = axis_obj.xscale(4:xscalel);
!       else
!       base = "";
!       endif
!       fprintf (plot_stream, "set logscale %s %s;\n", xaxisloc, base);
      else
        fprintf (plot_stream, "unset logscale %s;\n", xaxisloc);
      endif
  
!     ylogscale = strcmpi (axis_obj.yscale(1:3), "log");
      if (ylogscale)
!       yscalel = length(axis_obj.yscale);
!       if (yscalel > 3)
!       base = axis_obj.yscale(4:yscalel);
!       else
!       base = "";
!       endif
!       fprintf (plot_stream, "set logscale %s %s;\n", yaxisloc, base);
      else
        fprintf (plot_stream, "unset logscale %s;\n", yaxisloc);
      endif
  
!     zlogscale = strcmpi (axis_obj.zscale(1:3), "log");
      if (zlogscale)
!       zscalel = length(axis_obj.zscale);
!       if (zscalel > 3)
!       base = axis_obj.zscale(4:zscalel);
!       else
!       base = "";
!       endif
!       fprintf (plot_stream, "set logscale z %s;\n", base);
      else
        fputs (plot_stream, "unset logscale z;\n");
      endif

reply via email to

[Prev in Thread] Current Thread [Next in Thread]