4.85714

4.9 | 7 ratings Rate this file 130 downloads (last 30 days) File Size: 2.25 KB File ID: #2430

createLineInColorOrder

by Greg Aloe

 

24 Sep 2002 (Updated 02 Jul 2009)

Code covered by BSD License  

Force each created line to obey the axes 'ColorOrder' property.

Download Now | Watch this File

File Information
Description

*** NOTE: As of MATLAB® 7.0 (R14), this feature is available at the axes level by using the command "hold all". Use "doc hold" for more information. ***

When lines are created using MATLAB PLOT commands, they are created in a color order specified by the axes' 'ColorOrder' property. However, this only works if you plot multiple lines using the same call to PLOT. Otherwise, they are all created using a single default color.

This function will help you to force all lines within an axes to be plotted in the 'ColorOrder' of that axes, regardless of whether they are all created using the same PLOT command or multiple plot commands.

See "help createLineInColorOrder" for more information.

Works for at least MATLAB® 5.2 (R10) and later.

MATLAB release MATLAB 6.5 (R13)
Zip File Content  
Other Files createLineInColorOrder.m,
license.txt
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (7)
31 Mar 2003 Sarah Green

This is a very useful utility. It works at root, figure, or axis level.
I've been looking for a way to do this for ages!
Thanks.

26 Jul 2003 Nate Bachman

Note: the help says 'ON' but you have to use 'on'. no big deal. Also note that the legend defaults do not follow the colororder property (not the fault of this program).

Kudos to Greg for solving a problem that shouldn't exist. Please, Mathworks.

19 Apr 2005 S Goswami

Fantastic. Just what I have been trying to do for the last two hours!! Thanks a lot.

05 Aug 2005 Val Anderson

This is a good program. But, you need to do

   createLineInColorOrder off;

before you create a legend. The legend() call seems to call createLineInColorOrder for some reason, and then the legend colors get messed up. Turning createLineInColorOrder off before you call legend() seems to get around this.

01 Feb 2006 Khalid Nazzal

that is amazing, save a lot of time

14 Sep 2006 Jr Tes  
15 Nov 2007 Mathew Owens

A useful piece of code.

Please login to add a comment or rating.
Updates
22 Nov 2002

M-File was not downloading, so I'm resubmitting it without changes.

06 Feb 2003

Made the interface easier to use for root, figure, or axes ancestry.

20 Apr 2005

Note about feature availability in MATLAB 7.0 (R14)

02 Jul 2009

Updated submission description to add a registered trademark to MATLAB®.

Tag Activity for this File
Tag Applied By Date/Time
annotation Greg Aloe 22 Oct 2008 06:52:12
customization Greg Aloe 22 Oct 2008 06:52:12
colororder Greg Aloe 22 Oct 2008 06:52:12
line Greg Aloe 22 Oct 2008 06:52:12
color Greg Aloe 22 Oct 2008 06:52:12
order Greg Aloe 22 Oct 2008 06:52:12
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com