Background of a scatter plot

11 visualizaciones (últimos 30 días)
Bran
Bran el 28 de Jun. de 2016
Respondida: Chad Greene el 28 de Jun. de 2016
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

Respuestas (1)

Chad Greene
Chad Greene el 28 de Jun. de 2016
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])
Above I used rgb('dull brown') to get RGB values of a non-bright color.
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)

Categorías

Más información sobre Scatter Plots 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!

Translated by