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

 
 

bug #39344: Correct ColorOrder over multiple plots

Submitter:  Carl <costerwi>
Submitted:  Tue 25 Jun 2013 07:02:53 PM UTC
   
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 3.6.4 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 11 Jul 2013 08:17:24 PM UTC, comment #9: 

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

Rik <rik5>
Group administrator
Thu 11 Jul 2013 06:07:27 PM UTC, 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 11 Jul 2013 04:39:47 PM UTC, 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.


x = [1:5]';
y = [x, flipud(x)];
plot (x,y)


Rik <rik5>
Group administrator
Wed 10 Jul 2013 01:54:52 AM UTC, 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>
Group administrator
Mon 08 Jul 2013 03:49:58 PM UTC, 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 7.14.0.739 (R2012a) and I've posted the result.  In this case it's not as busted as Octave.  :)

Thanks!
-Carl


Carl <costerwi>
Tue 02 Jul 2013 11:41:33 PM UTC, 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>
Group administrator
Wed 26 Jun 2013 05:13:43 PM UTC, 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 26 Jun 2013 11:15:18 AM UTC, comment #2: 

Sorry, my mistake.  spectrum_test is:

figure
set(gcf, 'DefaultLineLineWidth', 5);
set(gcf, 'DefaultAxesLineStyleOrder', '-|--|:');
for i = 1:25
    subplot(3, 1, 1);
    plot([i, i], [0, 5]); hold all;
    subplot(3, 1, 2);
    plot([i, i], [0, 5]); hold all;
    subplot(3, 1, 3);
    plot([i, i], [0, 5]); hold all;
end
print -dpng spectrum_test.png


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

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

Rik <rik5>
Group administrator
Tue 25 Jun 2013 07:02:53 PM UTC, 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 Files:
   
   
Comment:
   

Attached Files
file #28546:  16955.patch added by costerwi (1KiB - application/octet-stream)
file #28424:  spectrum_test.m added by costerwi (341B - application/octet-stream)
file #28415:  hold_all.patch added by costerwi (4KiB - 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
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by costerwi (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 14 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-07-11 rik5 StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2013-07-11 costerwi Attached File- Added 16955.patch, #28546
    2013-07-11 rik5 StatusFixed In Progress
        Open/ClosedClosed Open
    2013-07-10 rik5 StatusNeed Info Fixed
        Open/ClosedOpen Closed
    2013-07-08 costerwi Attached File- Added spectrum_test_matlab.png, #28513
    2013-07-02 rik5 StatusNone Need Info
    2013-06-26 costerwi Attached File- Added spectrum_test.m, #28424
    2013-06-25 costerwi Attached 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.13-f8d8.
    Corresponding source code