Is there any way of doing this? Can I e.g. specify the
RGB values of the image pixels individually?
S.M.
Is there any way of doing this? Can I e.g. specify the
RGB values of the image pixels individually?
S.M.
You can set the transparency using the 'AlphaData' property:
%---------
[n1,n2] = meshgrid(-5:5);
x = rand(size(n1));
hImage = imagesc(x)
idx_Invisible = abs(n1+n2)<3;
set(hImage,'AlphaData', idx_Invisible);
%---------
It seems to take significantly longer to display though.
Yes, you can use RGB values. Just feed the IMAGE command a MxNx3 matrix.
imagesc(rand(5,5,3));
Jordan
Quote:> Is there any way of doing this? Can I e.g. specify the
> RGB values of the image pixels individually?
> S.M.
function colorpixel(xpos,ypos,coloropt)
for i=1:length(xpos)
patch([xpos(i)-0.5 xpos(i)+0.5 xpos(i)+0.5 xpos(i)-0.5],...
[ypos(i)-0.5 ypos(i)-0.5 ypos(i)+0.5 ypos(i)+0.5],...
coloropt,'edgecolor','none','tag','colorpixel');
end
Note that I included tags on the patches. That allows you to easily toggle
the patches on and off.
HTH,
Brett
Quote:> Is there any way of doing this? Can I e.g. specify the
> RGB values of the image pixels individually?
> S.M.
1. Large array w/ NaN's -> cell array w/o NaN's
Here's a conversion problem. I'm not very good at these yet.
I have 3 arrays...
R = [2974x73]
A = [2974x73]
E = [2974x73]
...where R,A, and E are all formatted something like this...
R = [ 1 2 3 4 5 ...
1 2 NaN 4 5 ...
1 NaN NaN 4 5 ...
1 NaN NaN NaN 5 ...
NaN NaN NaN NaN 5 ...
NaN NaN NaN NaN 5 ...
NaN NaN NaN NaN 5 ...
... etc. ]
...so that if you did the following...
tmp(:,:,1) = R;
tmp(:,:,2) = A;
tmp(:,:,3) = E;
...the NaN's will be on top of each other. Also, the NaN's always
come after the data I'm interested in. So there are no data points of
interest after the 4th row in the 1st column of R above.
I'm not sure why the data is formatted like this and I realize this is
a huge waste of space. Unfortunately, I have no control over this
fact. What I'm trying to get is a cell array that is formatted like
this...
C = {73x1} where each cell is [3xM] and M is the length of meaningful
data (no NaN's) in a given column of R, A, and E. I'm sure there's an
elegant way to do this, but I'm not sure what that is.
Thanks in advance,
Dave
3. How to export black and white eps figure (contour plot)?
4. questions on writing driver for T1/E1 NIC card?
5. Getting rid of white space on plots?
6. creating a relational database: how to plan?
7. How to get white plot back-ground?
10. contourf plot NaNs with "black" color
11. plot NaNs with black color
13. Printing contour in white?