bugGNU Octave - Bugs: bug #63681, [feature request] plotyy axes...


bug #63681: [feature request] plotyy axes should synchronize number of ticks and zero-crossing (initially)

Submitter:  Muhali <muhali>
Submitted:  Thu 19 Jan 2023 08:32:53 AM UTC
Category:  Plotting Severity:  3 - Normal
Priority:  2 Item Group:  Feature Request
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Sat 28 Jan 2023 09:05:52 PM UTC, comment #1: 

I don't think this is a Matlab compatibility issue, as much as it is a feature request.  For example, Octave and Matlab make different choices about the xlimits and ylimits for this simple code:

x = 1:10;
y = x - 6;
plot (x,y)

Matlab chooses xlimits of [1, 10] while Octave uses [0, 10].  Matlab chooses ylimits of [-5, 4] while Octave chooses [-6, 4].  This amounts to a difference of opinion, rather an incompaptibility between the two programs.  And it is simple to change the limits and ticks using various functions like ylim(), yticks(), or directly setting axes properties.

In the case of plotyy, the summary of the function is "Plot two sets of data with independent y-axes and a common x-axis."  In Octave, the y-axes really are independent and there is no code requiring that the 0-level on one axes match the 0-level on the other.

So, I'm changing the Item Group to Feature Request.  It is probably possible to write some sort of logic that decides on synchronization of number of ticks and on axes limits.

I'm lowering the Priority because there are easy workarounds.  The two axes objects are returned from plotyy() and it is simply to set ylim() and yticks() to achieve any desired synchronization of the two axes.

Rik <rik5>
Group administrator
Thu 19 Jan 2023 08:32:53 AM UTC, original submission:  

This example

x = 1 : 10 ;
f1 = 0 * x ;
f2 = x - 6 ;
ax = plotyy(x, f1, x, f2) ;
grid(ax(1), 'on')
grid(ax(2), 'on')
print('octave.png') ;

shows that the zero line is located differently between octave and matlab (see also attached figures).

Muhali <muhali>


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

Attach Files:

Attached Files
file #54246:  octave.png added by muhali (20KiB - image/png)
file #54247:  matlab.png added by muhali (11KiB - image/png)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by muhali (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
    2023-01-28 rik5 Priority5 - Normal 2
        Item GroupMatlab Compatibility Feature Request
        Release8.0.90 dev
        Summaryplotyy axis limits incorrect [feature request] plotyy axes should synchronize number of ticks and zero-crossing (initially)
    2023-01-19 muhali Attached File- Added octave.png, #54246
        Attached File- Added matlab.png, #54247

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code