What if you are plotting multiple graphs on a single MATLAB display… For plotting multiple graphs in a single window, it very difficult to distinguish one graph from another graph. Let’s take an example. You are plotting graphs for multiple mathematical equations like a sin wave, cos wave, exponential function on the same MATLAB display. After the running MATLAB program, you will get a number of graphs on the single MATLAB display. The end user will get more confused and will find it more difficult to understand and distinguish multiple graphs. So you need to decorate each graph differently, like assigning a different color to each curve. Each color describes one graph and that makes the graph self-descriptive.

How can you decorate your MATLAB graph?

In this tutorial, you will learn to plot the colorful graphs in MATLAB. I am also explaining by plotting a graph for the mathematical equation on MATLAB R2013a by using a single color, simple marker and line specification. We will also see what are the most important and useful color coding functions, marker style and line-specification designing functions available in MATLAB. By using these functions, you can draw the graph or waveform as per your color and plotting style choice. And you can easily understand the particular equation’s graph. Let’s begin by considering the top three essential components to decorate your graph more meaningful.
  • Colour
  • Marker Style
  • Line Specification
Explanation of these three component functions are one-by-one,

MATLAB Plot Colors to draw the Graph

If you are drawing any picture on paper, you have different color pencils to use. Likewise, for plotting the graph on MATLAB, we have different colors code or functions. Widely, eight colors are used for MATLAB graph. And each color has the corresponding color code. The below table shows color specification with the color code.  
Sr.No. Colour Name Colour Short Name RGB Triplet Hexadecimal Colour Code [Useful in MATLAB Program]
1 Black k [0 0 0] ‘#000000’
2 Blue b [0 0 1] ‘#0000FF’
3 Green g [0 1 0] ‘#00FF00’
4 Cyan c [0 1 1] ‘#00FFFF’
5 Red r [1 0 0] ‘#FF0000’
6 Magenta m [1 0 1] ‘#FF00FF’
7  Yellow y [1 1 0] ‘#FFFF00’
8 White w [1 1 1] ‘#FFFFFF’
You can use these eight colors code to draw the colorful waveforms in MATLAB.