Background of a scatter plot
조회 수: 5 (최근 30일)
이전 댓글 표시
I would like to set the background of an animated scatter plot. At the moment I am animating the plot in the following way: M = min(A1(:)); N = max(A1(:)); P = min(B1(:)); Q = max(B1(:)); a = [1:24]'; hold on
pause; for i = 1:10
A = DD(1:2:end,i);
B = DD(2:2:end,i);
h = scatter(A,B,[],a,'filled') colormap(jet) dx = 0.009; dy = 0.009; b = num2str(a); c = cellstr(b); text(A+dx, B+dy, c);
ylim([P Q]);
xlim([M N]);
xlabel('no on text')
ylabel('Overall score')
pause(2) hold off
I would like several rectangles plotted in the background for example one rectangle from x= 12 to x = 20 and y = 10 to y = 15 , I did try something with the patch command but the colours were very bright and I wasnt sure how to make them transparent
Any suggesting would be great Thank you in advance
댓글 수: 0
답변 (1개)
Chad Greene
2016년 6월 28일
Bran, you've provided lots of code, but we can't run it. If your question is specific to your code, make sure you provide code we can run. If your question is about how to make a rectangle, one way is to use the rectangle command:
rectangle('position',[12 10 8 5],'facecolor',[0.53 0.43 0.79])
If you need to set the transparency of a patch object, you can do so like this:
h = patch([12 20 20 12 12],[10 10 15 15 10],[0.53 0.43 0.29]);
set(h,'facealpha',0.5)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!