![]() 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') Set(ha,'ColorOrder',mpdc10) % - set ColorOrder HERE. The process is simplified, requiring no for loop, with the ColorOrder axis property: Mpdc10 = distinguishable_colors(10) % 10x3 color list For example, to generate 10 "maximally perceptually-distinct colors" and use them for 10 plots on the same axis ( but not using ColorOrder, thus requiring a loop): % Starting with X of size N-by-P-by-2, where P is number of plots 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 in 2010 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, when 25 colors 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.Ī 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 ColorOrder axes property allows MATLAB to automatically cycle through a list of colors when using hold on/all (again, see Appendix below for how to set/ get the ColorOrder for a specific axis or globally via DefaultAxesColorOrder). There is a great tool on the MATLAB Central File Exchange to generate any number of visually distinct colors, if you have the Image Processing Toolbox to use it. ![]() But because there are so many data sets, some of the lines have markers in, making the plot difficult to read. For information on how to change the 'ColorOrder' property and how to set a global default with 'DefaultAxesColorOrder', see the "Appendix" at the bottom of this post. Learn more about plot, yyaxis, line style, dashed, dat file, table, line plot MATLAB.You should now have an Electrical Pulse line style available from the Style menu on the Properties Toolbar, Line Style toolbar, and the Properties panel. The Line Style Editor closes and Electrical Pulse is shown as a line style in our Engineering line style set.Ĭlick OK twice to get back to the main workspace. The Add Component dialog box closes and Text is listed under Components in the Line Style Editor.Ĭlick OK. The Add Component dialog box closes and Dash is listed under Components in the Line Style Editor.Ĭlick the to the left of the Components list again and add a Text component.For example, xline ( 12 20 33,'-b') creates three dashed blue lines. example xline (x,LineSpec) specifies the line style, the line color, or both. For example, xline (2) creates a line at x2. Select Dash from the Type menu and click OK. Description example xline (x) creates a vertical line at one or more x -coordinates in the current axes. Click the to the left of the Components list (the one circled above).Create Line Plot with Markers Add markers to a line plot to distinguish multiple lines or to highlight particular data points. The Add Line Style dialog box appears.Įnter Electrical Pulse in the Name field and click OK. Create a 2-D line plot and specify the line style, line color, and marker type. The Edit Line Style Set dialog box appears.Ĭlick Add. Select New, then enter Engineering in the Title field.Ĭlick OK. The Add Line Style Set dialog box appears. ![]() You can also use the Properties panel: right-click the line and select Properties to open it and go to Style > Manage.Įither method opens the Manage Line Style Sets dialog box.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |