Various marker sizes in a single plot
13 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Aaron Mears
el 15 de Nov. de 2015
Comentada: Aaron Mears
el 15 de Nov. de 2015
I am working on an assignment that requires that I create a solar system animation of three planets and a sun. So far I have all 3 planets and the sun, the planets are orbiting the sun. However, I want the sun to be a different marker size than the planets and I can't seem to get it to work. I was under the impression that you were able to specify individual sizes, colors, etc...for each variable set. I have changed the colors successfully, but not the size. Here is the loop I am running for this animation:
for j = 1:length(x)
pause(0.05)
plot(0,0,'r.',x(j),y(j),'b.',a(j),b(j),'g.',c(j),d(j),'y.','markersize',20)
axis([minx maxx miny maxy]);
end
The first item in that plot set is the sun. I have just set it to 0,0 and colored it red. I've tried adding a marker size to it individually like this:
plot(0,0,'r.','markersize', 60,x(j),y(j),'b.',a(j),b(j),'g.',c(j),d(j),'y.','markersize',20)
However, with this I get the error "invalid first data argument" I am not sure why because as I've read that this should be able to be done this way. I've also tried giving every single variable set their own, with the same error.
0 comentarios
Respuesta aceptada
Walter Roberson
el 15 de Nov. de 2015
Only the last Name/Value specification is paid attention to for any one named option used in a plot() call. This is not the case for "linespec" specifications given without a parameter name (such as 'r-o' for sold red lines with red circle markers).
To set multiple marker sizes you need to assign the output of the plot call to a variable and set() the appropriate handle
h = plot(0,0,'r.',x(j),y(j),'b.',a(j),b(j),'g.',c(j),d(j),'y.','markersize',20)
set(h(1), 'markersize', 60)
Más respuestas (0)
Ver también
Categorías
Más información sobre Earth and Planetary Science en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!