bugGNU Octave - Bugs: bug #39393, set (ax, 'xscale', 'log') doesn't...


bug #39393: set (ax, 'xscale', 'log') doesn't result in full logarithmic axis

Submitted by:  Ronald <revdmeer>
Submitted on:  Tue 02 Jul 2013 07:02:41 AM UTC  
Category:  Plotting Severity:  3 - Normal
Priority:  3 - Low Item Group:  Matlab Compatibility
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  dev Operating System:  Any

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Wed 16 Nov 2016 09:03:03 PM UTC, comment #4: 

Updating release, bug is still present in the development version of Octave (4.3.0+).

Mike Miller <mtmiller>
Project Administrator
Wed 03 Jul 2013 02:39:12 PM UTC, comment #3: 

With your extra information I re-opened the bug report.  I'm lowering the priority because there is a workaround.  I also changed the type to "Matlab Compatibility" rather than "Incorrect Result".  Finally, I re-titled the report since this isn't about plotyy, per se, but rather the behavior of Octave when 'xscale' is changed.

Rik <rik5>
Project Administrator
Wed 03 Jul 2013 08:21:55 AM UTC, comment #2: 

Hello Rik,

Thank you for pointing out the "@semilogx" option for me. This does indeed do what i need. However the original bug is still valid.

Octave should threat XScale like both Matlab and gnuplot threat it. Which is that XTick, XTickLabel and Xminortick values should be updated when XScale changes value.

In Matlab there seems to be no change in behavior between

[ax, h1, h2]=plotyy(1:100,1:100,1:100,(1:100)/2)


 [ax, h1, h2]=plotyy(1:100,1:100,1:100,(1:100)/2, @semilogx, @semilogx)

In Matlab (2012b version):

[ax, h1, h2]=plotyy(1:100,1:100,1:100,(1:100)/2);
ans =

     0    10    20    30    40    50    60    70    80    90   100
ans =
ans =
ans =
     1    10   100
ans =
ans =

In Matlab when XTickmode=manual, only the Xminortick changes when XScale changes. XTick values and XTickLabel remain unchanged.

Ronald <revdmeer>
Tue 02 Jul 2013 11:19:14 PM UTC, comment #1: 

I think there may be some confusion about the difference between logarithmic scaling and a logarithmic axis.  Setting the 'Xscale' to log results in logarithmic spacing for the existing 'Xtick' values.

A logarithmic axis is really a collection of options which together produce what one thinks of as a log axis.  These include:

Xscale = log
Xtick = logarithmic values such as [1 10 100]
Xminortick = on
Xtickmode = auto

'help plotyy' gives an example of using a linear y-axis and a logarithmic y-axis together in plotyy.  You can get a logarithmic x-axis with

[ax, h1, h2]=plotyy(1:100,1:100,1:100,(1:100)/2, @semilogx, @semilogx)

Or you can set all of the properties I mentioned on each of the axes.

This, anyways, is how Octave treats Xscale.  If you have access to Matlab you might verify that setting Xscale to 'log' only scales the axis but does not produce the other changes such as the Xminorticks that are associated with a logarithmic axis.

Rik <rik5>
Project Administrator
Tue 02 Jul 2013 07:02:41 AM UTC, original submission:  

By default a plotyy results in linear axes. This can be changed to logarithmic e.g. with:


In the fltk backend the ticks will remain linear instead of logarithmic. In the gnuplot backend the visual result is correct. However when getting the XTick values from the axis with e.g.:


... still gives the linear values, instead of the logarithmic values.

To reproduce with the fltk backend:

graphics_toolkit fltk
[ax, h1, h2]=plotyy(1:100,1:100,1:100,(1:100)/2)

The XTick position are now linear, but they should be logarithmic.

To reproduce with the gnuplot backend:

graphics_toolkit gnuplot
[ax, h1, h2]=plotyy(1:100,1:100,1:100,(1:100)/2)
ans =

     0    20    40    60    80   100
ans =
  [1,1] = 0
  [1,2] = 20
  [1,3] = 40
  [1,4] = 60
  [1,5] = 80
  [1,6] = 100

Now the plot is visually correct, with XTick labels at 1, 10 and 100. However answer from the above get commands still incorrect.

Ronald <revdmeer>


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

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


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

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-11-16 mtmiller Release3.6.4 => dev
    2013-07-03 rik5 Priority5 - Normal => 3 - Low
        Item GroupIncorrect Result => Matlab Compatibility
        StatusInvalid => Confirmed
        Open/ClosedClosed => Open
        Summaryplotyy log scale results in linear ticks => set (ax, 'xscale', 'log') doesn't result in full logarithmic axis
    2013-07-02 rik5 StatusNone => Invalid
        Open/ClosedOpen => Closed

    Back to the top

    Powered by Savane 3.5