Various marker sizes in a single plot
11 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Walter Roberson
2015-11-15
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)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Earth and Planetary Science 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!