octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #50509] Tick labels are "added" in tick=auto,


From: Dan Sebald
Subject: [Octave-bug-tracker] [bug #50509] Tick labels are "added" in tick=auto, label=manual mode
Date: Fri, 10 Mar 2017 12:47:32 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0

URL:
  <http://savannah.gnu.org/bugs/?50509>

                 Summary: Tick labels are "added" in tick=auto, label=manual
mode
                 Project: GNU Octave
            Submitted by: sebald
            Submitted on: Fri 10 Mar 2017 05:47:31 PM UTC
                Category: Plotting with gnuplot
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: GNU/Linux

    _______________________________________________________

Details:

This is a very subtle bug in which some vestigial tick labels that gnuplot
automatically sets remain after octave does a manual placement of tick labels.
 It only happens when the gnuplot auto placement doesn't agree with octave's
auto placement of ticks.

This should illustrate:


octave:13> plot(sin(2*pi*[0:700]/200))
octave:14> get(gca, 'xticklabel')
ans = 
{
  [1,1] = 0
  [1,2] = 200
  [1,3] = 400
  [1,4] = 600
  [1,5] = 800
}
octave:15> set(gca, 'xticklabel', [])
octave:16> drawnow('qt', '/dev/null', 'junk.gp')


For that choice of signal and x-range, gnuplot's automatic ticks are 0, 100,
200, 300, 400, 500, 600, 700, 800.  The set command is an attempt to leave the
ticks but drop the labels.  However, in the plot 100, 300, 500, 700 are all
still visible.

Here is pertinent gnuplot code that is produced by the above sequence:


set xtics in scale  1.4 border mirror textcolor rgb "#262626" font ",10";
set xtics add in scale  1.4 border mirror ( "" 0,  "" 200,  "" 400,  "" 600, 
"" 800) textcolor rgb "#262626" font ",10";


If I manually change the above lines to


set xtics in scale  1.4 border mirror ( "" 0,  "" 200,  "" 400,  "" 600,  ""
800) textcolor rgb "#262626" font ",10";


Things look as expected... well, to some degree.  The result still leaves
extra blank space along the bottom for tick labels even though there are none,
but I don't know whether it should be gnuplot or octave's roll to realize
this.

Anyway, the logic must not be quite right with the following from
__gnuplot_drawnow_axes__.m:


  if (strcmp (ticmode, "manual"))
    if (isempty (tics))
      fprintf (plot_stream, "unset %stics;\nunset m%stics;\n", ax, ax);
      return
    endif
    fprintf (plot_stream, "set %stics %s %s %s %s (", ax, tickdir,
             ticklength, axispos, mirror);
    fprintf (plot_stream, " %.15g,", tics(1:end-1));
    fprintf (plot_stream, " %.15g) %s;\n", tics(end), fontspec);
  else
    fprintf (plot_stream, "set %stics %s %s %s %s %s %s;\n", ax,
             tickdir, ticklength, axispos, mirror, colorspec, fontspec);
  endif
  if (strcmp (labelmode, "manual"))
    k = 1;
    ntics = numel (tics);
    nlabels = numel (labels);
    fprintf (plot_stream, "set %stics add %s %s %s %s (", ax,
             tickdir, ticklength, axispos, mirror);
    labels = strrep (labels, "%", "%%");
    for i = 1:ntics
      fprintf (plot_stream, " \"%s\" %.15g", labels{k++}, tics(i));
      if (i < ntics)
        fputs (plot_stream, ", ");
      endif
      if (k > nlabels)
        k = 1;
      endif
    endfor
    fprintf (plot_stream, ") %s %s;\n", colorspec, fontspec);
  endif





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?50509>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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