bugGNU Octave - Bugs: bug #50509, Tick labels are "added"...

 
 

bug #50509: Tick labels are "added" in tick=auto, label=manual mode

Submitter:  Dan Sebald <sebald>
Submitted:  Fri 10 Mar 2017 05:47:31 PM UTC
   
 
Category:  Plotting with gnuplot Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 19 Nov 2018 01:30:13 AM UTC, comment #5: 

@Dan: I pushed your patch here https://hg.savannah.gnu.org/hgweb/octave/rev/2e0500c57795.  Marking as fixed and closing report.

Rik <rik5>
Group administrator
Sat 17 Nov 2018 07:30:27 AM UTC, comment #4: 

Attached is a freshened patch.  It seems to address the issue in Bug #55038 as well.

(file #45460)

Dan Sebald <sebald>
Fri 16 Nov 2018 04:33:58 PM UTC, comment #3: 

@Dan: Someone just filed bug #55038 which looks related to this bug.  If it is, maybe you can refresh the patch attached to this report and we can kill both bugs.

Rik <rik5>
Group administrator
Wed 13 Dec 2017 06:11:54 PM UTC, comment #2: 

@Dan: Didn't see this report until now.  Could you refresh the patch so that it applies against the development branch?

Rik <rik5>
Group administrator
Fri 10 Mar 2017 06:14:53 PM UTC, comment #1: 

Please review the attached patch.  It seems that Octave does all the work of generating 'xtick' and 'xticklabel' (regardless of the tick mode and label mode) and there really is no interpretation left for gnuplot beyond just using what is present.  So, I've removed all but the one route for generating ticks in a command and dropped the "add".

(file #39966)

Dan Sebald <sebald>
Fri 10 Mar 2017 05:47:31 PM UTC, original submission:  

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


Dan Sebald <sebald>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by sebald (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-11-19 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2018-11-17 sebald Attached File- Added octave-no_gnuplot_auto_ticks-djs2018nov17.patch, #45460
    2018-11-16 rik5 Dependencies- bugs #55038 is dependent
    2017-12-13 rik5 StatusNone Confirmed
    2017-03-10 sebald Attached File- Added octave-no_gnuplot_auto_ticks-djs2017mar10.patch, #39966

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code