![]() ![]() 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. To get the ColorOrder RGB array used for the current axis, get(gca,'ColorOrder') 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. ![]() Some info on how to keep the color of data points' constant and change only background color of plot will be of great help. The default background color of a plot is White. They even made the excellent suggestion to set MATLAB's ColorOrder on startup to, distinguishable_colors(20) 1 Link Answered: Kherbache Abdelkader on Hi, I wanted to know as to how I can go about changing the background color in a plot. 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). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |