How can I limit the number of point/markers drawn per pixel in a plot to one

조회 수: 8 (최근 30일)
Brandon
Brandon 2025년 9월 15일
답변: J. Alex Lee 2025년 9월 15일
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
Matt J
Matt J 2025년 9월 15일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

J. Alex Lee
J. Alex Lee 2025년 9월 15일
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).

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

제품


릴리스

R2025a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by