# Colors

All the arguments below identified by rgb refer to a color specified in the usual Matlab way, i.e. as a 3-element row vector where each element is between zero and one. However, for convenience, you may also use two alternative formats when specifying colors with plt.

- The first alternative is to specify the color values as percents instead of fractions. For example the Matlab color triple [.23 .45 .67] may also be written as [23 45 67]. Whenever you include a number bigger than one in a color triple, plt assumes that you are using this entry style.
- The second alternative is to specify the red, green, and blue components as a single number with two digits assigned to each value. For example, the color triple shown above could also be written as 234567. For clarity, you may choose to always use six digits by using leading zeros when necessary, although the leading zeros are not required.

Based on the above description of the second alternative, you would expect that 013301 would represent the color triple [.01 .33 .01] however actually it represents the color triple [1.00 .33 1.00]. This is because the digits 01 are treated as a special case representing the color value 1.00. So for example, the following TRACEc argument specifies a 10-color trace sequence identical to the first 10 colors shown in the default color list below:
plt(...,'TRACEc',[000100; 010001; 000101; 010000; 206001;
010101; 016020; 203001; 012060; 200160])
The leading zeros add clarity, but they are not required. So for example the first entry in the array above could be written as 100 if you prefer brevity. Note that the second alternative style does not allow you to specify .01 in a color triple. In that highly unlikely case, you would have to use either the first alternative style or the traditional Matlab color triple format. Also, you must stick with the traditional Matlab format if you need to specify more than two decimal places of precision (which is also quite unusual).

### TRACEc
| plt(...,'TRACEc',ct); Specify trace colors. Usually, you will specify at least as many colors in ct as there are traces, however, if ct doesn't include enough colors, plt will start over from the beginning. For example, if you specify the trace colors with any of these commands: plt(...,TRACEc,[1 0 0; 1 1 0; 1 1 1]) plt(...,TRACEc,{[1 0 0]; [1 1 0]; [1 1 1]}) plt(...,TRACEc,[010000; 010100; 010101]) plt(...,TRACEc,{010000; 010100; 010101}) then plt will use red, yellow, and white respectively for traces 1,2, and 3. If you had a fourth trace, plt would use red for that trace and continue cyclically. If ct includes just a single color, then plt will use that color for all traces. The second form above (cell array of vectors) is particularly useful when transferring colors from one plot to another. (See the cum and mZoom functions inside gauss.m for an example of this.) If the TRACEc parameter is not included and color files are not being used (see 'ColorFile' below), then the following default colors are used: Default (for the first 40 lines):
              [0  1  0;   1  0  1;   0  1  1;   1  0  0;  .2 .6  1;  % plt default trace colors
               1  1  1;   1 .6 .2;  .2 .3  1;   1  1  0;   1 .2 .6;
              .5 .5 .5;  .2  1 .6;  .8  1 .5;  .6 .2  1;   0 .5  0;
              .5  0 .5;   0 .6 .6;   0 .3 .3;  .5  0  0;   0  0  1;
              .3 .3  0;  .7 .2 .2;  .2 .7 .2;  .3 .3 .3;  .4 .4 .7;
               0 .6 .3;  .8 .5 .5;  .4 .6 .3;  .5 .5  0;  .7 .7 .2;
              .5 .5  1;  .7 .2 .7;   1 .4 .4;  .4  1 .4;  .4 .9  0;
              .5 .1 .3;  .3  0 .8;  .5 .5 .8;   0 .3 .8;  .7 .2  0];
You will find a picture showing what these 40 colors look like in the Default colors section. These trace colors have been carefully chosen so that with a dark background the colors appear to be as different as possible. When using the first 10 or 20 colors distinguishing the traces based on the colors alone is quite easy although this starts getting a bit more challenging as more traces are added. The defaults for lines 41 to 80 are the same as the colors listed above for lines 1 to 40 except that they are 26% dimmer. The defaults for the lines 81 to 99 are again 26% dimmer than the trace colors for lines 41 to 59. Default colors are defined only for up to 99 traces. If you have more than 99 traces, plt will start assigning colors cyclically as described above.
### CURSORc
| plt(...,'CURSORc',rgb); Specify the cursor color. Here, and on the rest of this page,rgb must be a 3-element row or column vector. Defaults: Only one trace (dark plot backgrounds): [1 1 .5] Only one trace (light plot backgrounds): [0 0 .5] More than one trace: Cursor color is set to match trace color
### DELTAc
| plt(...,'DELTAc',rgb); Specify color indicating the delta cursor. Default: [1 0 0]
### PltBKc
| plt(...,'PltBKc',rgb); Specify the plot area background color. Default: [0 0 0]
### FigBKc
| plt(...,'FigBKc',rgb); Specify the figure window background color. Default: [.25 .15 .15]
### xyAXc
| plt(...,'xyAXc',rgb); Specify the color of the x and y axes. Default: [1 1 1]
### xyLBLc
| plt(...,'xyLBLc',rgb); Specify the color of the x and y axis labels. Default: [.64 .78 .94]
### GRIDc
| plt(...,'GRIDc',rgb); Specify the color of the grid lines. (See also GridStyle.) Normally the grid lines are drawn in exclusive-or erase mode, however, if any of the rgb values are negative (e.g. 'GRIDc',[0 -.2 .4] ), then the grids are drawn in normal mode, which is often preferable especially if the right-hand axis is not being used. The actual grid color used in the above example is [0 .2 .4]). Default: If no right-hand axis is enabled then the default is [-.13 .13 .13] i.e. a very dim gray line using normal erase mode. (The grid lines will be solid unless the GridStyle parameter is included). If a right-hand axis is enabled the defaults (again assuming that the GridStyle parameter is not specified), depending on the Matlab version. For Matlab versions earlier than R2014b the default GRIDc is [.13 .13 .13], and the default GridStyle is - i.e. a very dim solid gray line drawn using xor erase mode. For Matlab version R2014b or later the default GRIDc is [-.26 .26 .26], and the default GridStyle is : i.e. a dim gray dotted line in normal erase mode (which is the only erase mode supported in the newer Matlab versions). The defaults described above apply only if a very dark plot background is being used, including of course the default plot background (black). If a bright background has been selected (by using either the 'PltBKc' or 'COLORdef',0 parameters) then the defaults above are inverted (i.e. subtracted from one). These defaults may sound complicated but they have been chosen to be pleasing to most people under the various circumstances.
### TIDc
| plt(...,'TIDc',rgb); Specify the background color of TraceID box. Default: If this parameter is not included, the color specified by the PltBKc parameter (or its default) is used.
### COLORdef
| plt(...,'COLORdef',c); Sets the PltBKc, FigBKc, xyAXc, and xyLBLc colors mentioned above to be consistent with Matlab's current default colors. Trace colors are set as follows:
c = 0 or 'default' | Matlab's current default trace colors are used. i.e. TRACEc = get(0,'DefaultAxesColorOrder')
c is a 3 column array | c is used instead of Matlab's default trace color order. Note that you may use the traditional Matlab color triple entry or one of the alternate styles described above. The example program subplt8.m demonstrates how to use both the traditional and alternate color entry styles for this argument.
c is a 3-column array with a special first entry [.99 .99 .99] | The special case for the first entry (which is 999999 if using the alternate style) means that the remaining colors in the array will be appended to the current Matlab default trace colors. This is useful if you like Matlab's default colors, but the color sequence is not quite long enough and you just want to add a few colors to that sequence.
If TRACEc so defined has fewer rows than the number of traces to be plotted the colors will be used cyclically as described above.
### ColorFile
| plt(...,'ColorFile','filename'); The normal behavior of plt (i.e. when the ColorFile argument is not included) is as follows. If plt is called from the Matlab command line, when plt initializes it looks for a file called pltcolor.mat in the folder where you installed plt. If this file isn't found, no action is taken. If it is found, the file is loaded causing all the default colors and the colors specified by all the other parameters shown on this page to be overwritten with the data saved in the .mat file. When you select the "Save figure colors" selection under the Color menu, plt saves the current colors to this same file (pltcolor.mat). If plt is called from a Matlab function or script file, the behavior is similar except that the file name used is fnameColor.mat where fname is the name of the top-level Matlab command or script. Again, plt looks for this file in the folder containing the .m file defining fname (or in the folder containing the fname.exe file for compiled applications). When the 'ColorFile' parameter is included in the plt argument list, the above behavior is modified as follows:
'ColorFile','filename' | If the filename is specified without any path, plt uses the specified file name both on startup (to load the color scheme) and when "Save figure colors" is selected. plt looks for this file in the folder containing the .m file defining fname (or in the folder containing the fname.exe file for compiled applications). The extension used is always .mat and you may not include an extension or a period in the filename string.
'ColorFile', 'drive:\path\filename' | As above, plt uses the specified file both on startup (to load the color scheme) and when "Save figure colors" is selected. However, when path information is supplied, plt will look for the file only in the location given. As before, you may not include an extension in the filename string
'ColorFile','' | plt will use its default colors, and any colors specified by the other parameters in this section. A color file will never supersede them on startup, even if fnameColor.mat exists. If you select "Save figure colors", plt will allow you to save the current colors to any file of your choosing (by opening a file selection box), but these colors will not be loaded unless you change to one of the above 'ColorFile' options, or remove the 'ColorFile' parameter altogether.