Printing Colored Lines to Black & White Printers (Generating Output) (MATLAB)

Unless you have changed the default line style and color properties of the root object, MATLAB will by default plot lines in the "solid line" or ‘-’ setting. If you have several lines up at once, they may or may not be different colors, depending on how you plotted them. When you print these to a black and white printer, the lines might be difficult to distinguish from one another.

Another approach that will let you set the line style and color once for a session is with the following code.

tmp8414470_thumb

This uses a little Handle Graphics to change the default axes color to black only, and sets a line style order to continuous, dashed, dash-dotted, dotted, and circles. With this code, the styles are changed at the "root level," meaning that the properties are altered for all figures during the session. To return to the original MATLAB defaults, use

tmp8414471_thumb


If you want to make a different line style order, or axes color order the default every time you use your MATLAB, all you need to do is include the set code shown above in a file called startup.m; MATLAB looks for this file each time you start a MATLAB session. There is also a master MATLAB startup file called matlabrc.m and you can add or modify code there, but it is not advisable. If you want to change your MATLAB startup options, you should read the on-line helps on startup and matlabrc.

Next post:

Previous post: