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

 Submitter: 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

Comment Type & Canned Response:

## Discussion

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>
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>

## Attached Files

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

Attach Files:

Comment:

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

## Dependencies

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 project members can vote.