bugGNU Octave - Bugs: bug #48115, __plotyy__ function bug when using...

 
 

bug #48115: __plotyy__ function bug when using FUN2 argument

Submitted by:  None
Submitted on:  Fri 03 Jun 2016 03:36:06 PM UTC  
 
Category: PlottingSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: FixedAssigned to: None
Originator Name: Holger StrubeltOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 4.0.1
Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Thu 23 Nov 2017 05:45:34 PM UTC, comment #4:

Not changing the color of the y-axis when there is more than one line object is not an error, just a nuisance. Fixes to the stable branch of Octave are reserved for errors, so I applied the fix for coloring to the development branch of Octave here (http://hg.savannah.gnu.org/hgweb/octave/rev/8a89878ac8bc). This will eventually be part of the 4.4.0 release.

Thanks for noticing this and suggesting a fix.

Rik <rik5>
Project Administrator
Thu 23 Nov 2017 05:23:04 PM UTC, comment #3:

The error resulting from mismatched dimensions is fixed in this cset on the stable branch (http://hg.savannah.gnu.org/hgweb/octave/rev/e24bf08dc559). This will be a part of the bug fix release 4.2.2 which should happen at the end/start of this/next year.

Rik <rik5>
Project Administrator
Tue 07 Jun 2016 01:29:16 PM UTC, comment #2:

Encountered the bug when experimenting with assigning different line properties "on-the-fly". Plus, the y-axis coloring issue appeared simultaneously. The behaviour to color an axis only when 1 line is associated to the respective axis is the same as when using a well-known commercial product. See this code example for illustration:

+verbatim
## plotyy examples
x=(0:0.1:10)';
y1=[3sin(2x), 2.5*cos(x)];
y2=[sin(x/2), 0.9sin(x-0.5), 0.8cos(x/2)];
## plotyy with one line for left y axis => only left y axis should be colored
figure;
plotyy(x,y1(:,1),x,y2);
## plotyy with one line for right y axis => only right y axis should be colored
figure;
plotyy(x,y1,x,y2(:,1));
## plotyy with two inline functions => fails since FUN2 has wrong usage in _plotyy_ function
figure;
plotyy(x,y1,x,y2, ...
@(x,y) plot(x,y(:,1),'r-',x,y(:,2),'b*'), ...
@(x,y) plot(x,y(:,1),'g--',x,y(:,2),'m.-',x,y(:,3),'b-.'));

-verbatim

By the way, the second example shows another bug in automatic coloring: the first line in y2 is the same color as the last line in y1. I've also fixed this issue by evaluationg the number of plot lines in y1 before assigning the 'colororder' property to ax(2). This was not included in the original fix provided on Friday.

Added a diff file for all my changes. Not experienced in using diff or naming diff files, so I called it "plotyy_m_diff_u.txt".

Thanks for your help, even though I've already fixed everything myself ;)

(file #37423)

Anonymous
Fri 03 Jun 2016 04:11:05 PM UTC, comment #1:

@Holger: Thanks for looking at this issue. First, do you have an example of the bug that can be used for testing? It is always important to be able to verify the error exists, apply the patch, and re-verify that the error has been corrected.

Second, can supply a unified diff (diff -u) of your changes? This makes it easier to see what you have modified when reviewing.

Rik <rik5>
Project Administrator
Fri 03 Jun 2016 03:36:06 PM UTC, original submission:

When using a user function (e.g. anonymous function) for the secondary axes used by plotyy, a matrix index error is created.
The bug is in line 134 of function file plotyy.m within function _plotyy_:
The second argument ax(2) must be deleted since fun2 is evaluated on the current axes, which is set to ax(2) before that line.
I've attached a corrected version of plotyy.m.

In addition to said bug, I've added an improvement concerning coloring of the y-axes. This doesn't make sense if one of the plot contains multiple lines with different colors, since only the last line will control the y-axis color. So I added a check for the number of lines within the plot:
For axis 1:

For axis 2:

If the maintainer team doesn't follow my argument in this matter, please feel free not to include this change into a new version of plotyy.m.

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #37423:  plotyy_m_diff_u.txt added by None (2KiB - text/plain)
file #37377:  plotyy.m added by None (10KiB - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

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

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 23 Nov 2017 05:45:34 PM UTCrik5Item GroupNone=>Matlab Compatibility
      StatusIn Progress=>Fixed
      Open/ClosedOpen=>Closed
    Thu 23 Nov 2017 05:23:04 PM UTCrik5StatusNeed Info=>In Progress
    Tue 07 Jun 2016 01:29:16 PM UTCNoneAttached File-=>Added plotyy_m_diff_u.txt, #37423
    Fri 03 Jun 2016 04:11:18 PM UTCrik5StatusNone=>Need Info
    Fri 03 Jun 2016 03:36:06 PM UTCNoneAttached File-=>Added plotyy.m, #37377

    Back to the top


    Powered by Savane 3.1-cleanup1