bugGNU Octave - Bugs: bug #39344, Correct ColorOrder over multiple...


bug #39344: Correct ColorOrder over multiple plots

Submitted by:  Carl <costerwi>
Submitted on:  Tue Jun 25 19:02:53 2013  
Category: PlottingSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: 3.6.4Operating System: Any

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

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


(Jump to the original submission Jump to the original submission)

Thu Jul 11 20:17:24 2013, comment #9:

Okay, that seems to work correctly now. Closing this issue again.

Rik <rik5>
Project Administrator
Thu Jul 11 18:07:27 2013, comment #8:

Good catch! It seems that the code does not call _next_line_color_(0) in this case but assumes this to be the default behavior.

I added a line to each file which mimics this default behavior. I'm still fumbling a bit with mercurial but hopefully my attached patch will work for you.

(file #28546)

Carl <costerwi>
Thu Jul 11 16:39:47 2013, comment #7:

Carl, could you take another look at your solution. It is failing to change the colors for multiple plots done into a single axis.

The following code should produce a blue line and a green line. Instead both lines are blue.

Rik <rik5>
Project Administrator
Wed Jul 10 01:54:52 2013, comment #6:

Thanks for your work in solving this. I committed your change here (http://hg.savannah.gnu.org/hgweb/octave/rev/0dab17e69a55). You can see the change by building from Mercurial sources or wait until the next major release (3.8) of Octave. Closing report.

Rik <rik5>
Project Administrator
Mon Jul 8 15:49:58 2013, comment #5:

Hi Rik,

Sorry I wasn't aware of the Contributing Guidelines but I will certainly follow them in the future. I want to make it as easy as possible to share my bug fixes so we can all enjoy a better program.

A coworker ran the spectrum_test.m on Matlab (R2012a) and I've posted the result. In this case it's not as busted as Octave. :)


(file #28513)

Carl <costerwi>
Tue Jul 2 23:41:33 2013, comment #4:

I took a look at the patch and it generally looks fine. You might want to look at the chapter in the manual titled "Contributing Guidelines". We have a number of conventions that we use for m-files such as using '##' instead of '%' for comments or surrounding the test clauses in if statements with parentheses. I can modify it pretty easily, but if you get in the habit of contributing it will make it easier on the few of us available for triaging bugs if we can just apply the patch without modification.

Also, just to be sure, I'd like to have someone run spectrum_test.m on Matlab and upload the resulting png file. It may be that Matlab is just as busted and does not maintain a separate ColorOrder for each subplot axis.

Rik <rik5>
Project Administrator
Wed Jun 26 17:13:43 2013, comment #3:

A little more explanation:

The original code used persistent variables to keep track of the ColorOrder and color_index within that order. These variables were shared among all plots so they would interfere with each other and an individual plot would not follow its assigned ColorOrder. Also, the persistent ColorOrder did not always match with the actual ColorOrder assigned to the current plot.

The included patch reads the ColorOrder property for the current axes and calculates the color_index (and style_index) based on the number of children in that axes. This is independent of any other plots and provides a consistent and predictable result.

Carl <costerwi>
Wed Jun 26 11:15:18 2013, comment #2:

Sorry, my mistake. spectrum_test is:

Carl <costerwi>
Wed Jun 26 01:37:22 2013, comment #1:

The spectrum-test.m file is empty. Could you re-upload the file?

Rik <rik5>
Project Administrator
Tue Jun 25 19:02:53 2013, original submission:

The attached patch fixes a few problems with using "hold all" over multiple plots. This allows families of related plots to share a common color and style legend.

Please see the attached before and after plots produced by the attached "spectrum_test.m" script.

Please let me know if you have any trouble.

Carl <costerwi>


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

Attach File(s):

Attached Files
file #28546:  16955.patch added by costerwi (1kB - application/octet-stream)
file #28424:  spectrum_test.m added by costerwi (341B - application/octet-stream)
file #28415:  hold_all.patch added by costerwi (4kB - application/octet-stream)
file #28418:  spectrum-test.m added by costerwi (874B - application/octet-stream)


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 costerwi (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 14 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu Jul 11 20:17:24 2013rik5StatusIn Progress=>Fixed
    Thu Jul 11 18:07:27 2013costerwiAttached File-=>Added 16955.patch, #28546
    Thu Jul 11 16:39:47 2013rik5StatusFixed=>In Progress
    Wed Jul 10 01:54:52 2013rik5StatusNeed Info=>Fixed
    Mon Jul 8 15:49:58 2013costerwiAttached File-=>Added spectrum_test_matlab.png, #28513
    Tue Jul 2 23:41:33 2013rik5StatusNone=>Need Info
    Wed Jun 26 11:16:07 2013costerwiAttached File-=>Added spectrum_test.m, #28424
    Tue Jun 25 19:02:53 2013costerwiAttached File-=>Added hold_all.patch, #28415
      Attached File-=>Added spectrum_test_after.png, #28416
      Attached File-=>Added spectrum_test_before.png, #28417
      Attached File-=>Added spectrum-test.m, #28418

    Back to the top

    Powered by Savane 3.1-cleanup1