![]() |
Undocumented plot marker types - undocumentedmatlab
I wanted to take a break from my miniseries on the Matlab toolstrip to describe a nice little undocumented aspect of plot line markers. Plot line marker types have remained essentially unchanged in user-facing functionality for the past two+ decades, allowing the well-known marker types (.,+,o,^ etc.). Internally, lots of things changed in the graphics engine, particularly in the [URL="https://undocumentedmatlab.com/articles/hg2-update"]transition to HG2[/URL] in R2014b and the [URL="https://blogs.mathworks.com/graphics/2015/11/10/memory-consumption/#comment-465"]implementation of markers using OpenGL primitives[/URL]. I suspect that during the massive amount of development work that was done at that time, important functionality improvements that were implemented in the engine were forgotten and did not percolate all the way up to the user-facing functions. I highlighted a few of these in the past, for example transparency and color gradient for [URL="https://undocumentedmatlab.com/articles/plot-line-transparency-and-color-gradient"]plot lines[/URL] and [URL="https://undocumentedmatlab.com/articles/plot-markers-transparency-and-color-gradient"]markers[/URL], or [URL="https://undocumentedmatlab.com/articles/hidden-hg2-plot-functionality"]various aspects of contour plots[/URL].
Fortunately, Matlab usually exposes the internal objects that we can customize and which enable these extra features, in hidden properties of the top-level graphics handle. For example, the standard Matlab plot-line handle has a hidden property called [B]MarkerHandle[/B] that we can access. This returns an internal object that enables [URL="https://undocumentedmatlab.com/articles/plot-markers-transparency-and-color-gradient"]marker transparency and color gradients[/URL]. We can also use this object to set the marker style to a couple of formats that are not available in the top-level object: >> x=1:10; y=10*x; hLine=plot(x,y,'o-'); box off; drawnow;>> hLine.MarkerEdgeColor = 'r';>> set(hLine, 'Marker')' % top-level marker stylesans = 1×14 cell array {'+'} {'o'} {'*'} {'.'} {'x'} {'square'} {'diamond'} {'v'} {'^'} {'>'} {' |
所有时间均为北京时间。现在的时间是 23:26。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.