Define LaTeX colors that match Matlab plots

Define LaTeX colors that match Matlab plots

There exist several methods to define a specific color in LaTeX. My favorite one uses the xcolor package. First, place it to the preamble of the LaTeX file:

\usepackage{xcolor}

Then, you can define a new color as

\definecolor{darkgreen}{rgb}{0, 0.5, 0}

and use it in LaTeX text as

This is some {\color{darkgreen} dark green text}.

Finally, the following colors correspond to those of Matlab plot (starting from version R2014b)

\definecolor{matlab1}{rgb}{0.000, 0.447, 0.741} % blue
\definecolor{matlab2}{rgb}{0.850, 0.325, 0.098} % red
\definecolor{matlab3}{rgb}{0.929, 0.694, 0.125} % yellow
\definecolor{matlab4}{rgb}{0.494, 0.184, 0.556} % violet
\definecolor{matlab5}{rgb}{0.466, 0.674, 0.188} % green
\definecolor{matlab6}{rgb}{0.301, 0.745, 0.933} % light blue
\definecolor{matlab7}{rgb}{0.635, 0.078, 0.184} % dark purple

The following colors have been used in older versions of Matlab.

 
\definecolor{matlab1old}{rgb}{0.00, 0.00, 1.00} % blue
\definecolor{matlab2old}{rgb}{0.00, 0.50, 0.00} % green
\definecolor{matlab3old}{rgb}{1.00, 0.00, 0.00} % red
\definecolor{matlab4old}{rgb}{0.00, 0.75, 0.75} % azure
\definecolor{matlab5old}{rgb}{0.75, 0.00, 0.75} % magenta
\definecolor{matlab6old}{rgb}{0.75, 0.75, 0.00} % yellow
\definecolor{matlab7old}{rgb}{0.25, 0.25, 0.25} % gray

Leave a Reply

Your email address will not be published. Required fields are marked *