twitterhasem.blogg.se

Matlab plot colors
Matlab plot colors












matlab plot colors

A light mixture of red, green and blue, which looks like a dark gray.Ĭurrently (March 10th, 2016), I am using MATLAB R2015a and this is the colour map I get: > get(gca,'colororder').A mixture of red and green which is yellow.A mixture of red and blue, which is magenta.A mixture of green and blue, which is cyan.The first row denotes the first colour to go on the plot, followed by the second row denoting the second colour and so on.

Matlab plot colors mac osx#

On my machine at the time of this post when I was running MATLAB R2013a and with Mac OSX 10.9.5, this is what I got: > get(gca,'colororder')Įach row gives you the red, green and blue values for a particular colour. This will return a 2D matrix where each row gives you the proportion of red, green and blue for each plot that you produce. If you actually want to know what the colour order is for your plot, make sure the plot is open in MATLAB, then do the following: get(gca,'colororder') For versions after R2014b, this follows the parula colour map, where the first plot would be a lighter blue followed by the second plot being a copper orange of sorts. In the jet colour map, the first plot is blue, followed by the second plot being green. Take note that versions before R2014b, the default colour order for MATLAB uses the jet colour map. To get the default ColorOrder for new axes, get(0,'DefaultAxesColorOrder')Įxample of setting new global ColorOrder with 10 colors on MATLAB start, in startup.Good question! There is a default colour order for MATLAB. To get the ColorOrder RGB array used for the current axis, get(gca,'ColorOrder')

matlab plot colors

Mpdc10 = distinguishable_colors(10) % 10x3 color map Plot(X(:,ii,1),X(:,ii,2),'.','Color',mpdc10(ii,:)) Īlternatively, using the ColorOrder axis property simplifies the process: X = reshape(X,10,10,2) % for clarity, and to avoid loop Mpdc10 = distinguishable_colors(10) % 10x3 color list X = reshape(X,10,10,2) % for clarity, column is category, row is observation For example, to generate 10 "maximally perceptually-distinct colors" and use them for 10 plots on the same axis (not using ColorOrder): % Starting with X of size 100x2 Of course, you can set the ColorOrder for a single axis or simply generate a list of colors to use in any way you like. They even made the excellent suggestion to set MATLAB's ColorOrder on startup to, distinguishable_colors(20)

matlab plot colors

The GMPDC submission was chosen on MathWorks' official blog as Pick of the Week a few years ago in part because of the ability to request an arbitrary number of colors (in contrast to MATLAB's built in 7 default colors). Given an initial large list of possible colors, it iteratively chooses the entry in the list that is farthest (in Lab space) from all previously-chosen entries.įor example, here are the colors generated when 25 are requested: This function generates a set of colors which are distinguishable by reference to the "Lab" color space, which more closely matches human color perception than RGB. It is best described in the author's own words: For 10 plots, you obviously cannot rely on the default ColorOrder, so a great way to define N visually distinct colors is with the "Generate Maximally Perceptually-Distinct Colors" (GMPDC) submission on the MATLAB Central File File Exchange. However, by default MATLAB only specifies a short list of colors (just 7 as of R2013b) to cycle through, and on the other hand it can be problematic to find a good set of colors for more data series. The answers mentioning hold all are correct and useful for cycling through the colors specified by the ColorOrder axes property (even though just hold on is now equivalent to hold all).














Matlab plot colors