How can I limit the number of point/markers drawn per pixel in a plot to one
7 views (last 30 days)
Show older comments
I am creating a graphing utility for a standardized test that we do. The test has linear spaced x-axis points but is graphed logarithmically. I am attempting to add a transparency/opacity context menu modifier. I've verified that the alpha of the traces is changing in the way I'd expect. What's not happening how I'd expect is as the density of the drawn points gets higher the effective transparency is lowered. e.g. at 80% transparency the left hand side of the trace looks like 80% transparency however the righthand side looks close to 0% with somewhat of a gradient inbetween. What I believe is happening is that there are multiple points per pixel on the righthand side of the graph (32k points vs 1080pixels) and the rendering engine is putting multiple 20%opacity lines on top of the same pixel which results in the observed effect. This is all but confirmed zooming in a little (fig 2) where it can be seen that there is variability in the transparency opacity depending on where there multiple points per pixel and where there are not. Outside of writing a custom engine that adapts the displayed number of point to the zoom window (yuck), is there a simple setting I can change to limit the rendering to one point (averaged or not) per pixel?


1 Comment
Matt J
on 15 Sep 2025
We don't have the code and input data you used to generate the plots, so we don't know why you see what you see. Please use Run.
Answers (1)
J. Alex Lee
on 15 Sep 2025
One idea is to resample the points in log-space just for plotting, this way on a log plot you get the same pixel density (in the x-axis anyway).
0 Comments
See Also
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!