Find unused plot color
by Deborah
12 Jun 2012
(Updated 20 Jun 2012)
Find the first unused default color in a plot or generate a random one.
|
Watch this File
|
| File Information |
| Description |
Whenever plots are generated inside a loop with the figure put on hold, the normal plot command plots everything in the same color. When a different color is wanted, normally a color-vector needs to be generated.
With this function it is possible to call the color inside the plot command, using
plot(x,y,'color', which_color(gca))
It first uses all the specified colors in the ColorOrder. If all of them are used it generates a random color. |
| Required Products |
MATLAB
|
| MATLAB release |
MATLAB 7.10 (R2010a)
|
|
Tags for This File
|
| Everyone's Tags |
|
| Tags I've Applied |
|
| Add New Tags |
Please login to tag files.
|
| Updates |
| 20 Jun 2012 |
Simplified the way the color was determined thanks to Jan's suggestions. |
|
Contact us