Various marker sizes in a single plot
조회 수: 6 (최근 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!