Plot MarkerSize units normalized
Mostrar comentarios más antiguos
Hello! I need to plot a lot of circle of a precise size every small time-step. I was using a for with plot rcos-rsin, but it was very slow. Then I tried scatter that was very faster, but finally I used plot with 'o' parameter and MarkerSize set, that is absolutely the fastest solution. The only problem I have is the size of the marker, that never matches with what I suppose to. I tried changing 'units' to 'normalized' to both gca and gcf, but it doesn't seem to affect the MarkerSize option.
So, how do I get MarkerSize proportional to axes? Thank you.
Respuesta aceptada
Más respuestas (1)
Kelly Kearney
el 4 de Dic. de 2013
How were you calling the circle-equation version? And how many objects are you plotting?
I ran a quick test:
ncirc = 10;
npt = 20; % # of points defining each circle
x = rand(ncirc,1)*10;
y = rand(ncirc,1)*10;
r = rand(ncirc,1)*2;
theta = linspace(0, 2*pi, 20);
xc = bsxfun(@plus, x, bsxfun(@times, r, cos(theta)));
yc = bsxfun(@plus, y, bsxfun(@times, r, sin(theta)));
figure;
hold on;
t(1) = timeit(@() scatter(x,y,r*200,'b')); % Just an example... not scaled
t(2) = timeit(@() plot(xc', yc'));
With ncirc = 10:
t =
0.016969 0.061804
And with ncirc = 1000:
t =
0.11602 0.061678
To adjust marker size using plot, you're going to have to create separate graphics objects for each individually-sized marker, so I doubt you would gain a ton of speed.
1 comentario
Alessandro Masullo
el 4 de Dic. de 2013
Categorías
Más información sobre Annotations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!