![]() See here for all patch properties.Īgain if you don't know what some function does, always check matlab documentation with help function_name or doc function_name. ![]() You get XData and YData properties to get the patch coordinates. You have to draw patches over it with yellow color (set by 'y' parameter) and 0.5 transparancy. Since box is a line object it doesn't have FaceColor or FaceAlpha (transparancy) properties as for patch, so you cannot color it directly. You can see all properties for a given handle with get(h(1)) or inspect(h(1)).įor example you can set line width: set(h,'LineWidth',3) You use the handle to modify the object properties. Tags for all objects in boxplot you can find in the official MW documentation (just before examples):įINDOBJ returns handles to all objects it found into variable h, which is double array. 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.With FINDOBJ function you search for graphic objects with tag equals to 'Box' in the current axes (gca = get current axis handle). 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. They even made the excellent suggestion to set MATLAB's ColorOrder on startup to, distinguishable_colors(20) ![]() 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. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |