What is the default MATLAB Color Order?

后端 未结 2 1581
醉梦人生
醉梦人生 2020-12-08 15:22

I have a plot with two histograms. However, it is difficult to tell which histogram on the plot is coming from the first set of data and which graphs the second set of data.

2条回答
  •  一整个雨季
    2020-12-08 16:01

    There exists a colormap for this specific purpose - lines (Introduced before R2006a). Here's what lines.m says:

    %LINES  Color map with the line colors.
    %   LINES(M) returns an M-by-3 matrix containing a "ColorOrder"
    %   colormap. LINES, by itself, is the same length as the current
    %   colormap. If no figure exists, MATLAB uses the length of the
    %   default colormap.
    

    If you open the documentation of lines, you can see a preview image that looks very much like what appears in rayryeng's answer:

    Thus, as long as you're using the default colormap, to know the colors of the first n lines, all you need to do is call lines(n).

提交回复
热议问题