From: Wendy on
Hi all,

I read in a matrix from xls file. The matrix is as follows

pvalue = [ NaN NaN NaN NaN;
NaN NaN 1.00000000000000e-05 NaN;
NaN 4.00000000000000e-05 0 NaN;
NaN 0 0 NaN;
NaN NaN NaN NaN];

Those NaN elements are empty in the excel file. As all the pvalues are >=0, I set NaN elements to -2, and set caxis=([0 4e-5]). As -2 is out of my caxis, all the -2 elements are plotted with the minimum caxis. I want the -2 elements to be empty on the plot, like surf function does. Can anyone give me some hint on this issue? I was suggested to set a color code for -2 element, but I could not find how to set a color code to a value.

Thank you very much.
Wendy
From: Anthony Hopf on
Why not keep the NaN values and plot that? The NaN values will have their own color assigned to them.

"Wendy " <wlq121(a)gmail.com> wrote in message <hpa86g$ngb$1(a)fred.mathworks.com>...
> Hi all,
>
> I read in a matrix from xls file. The matrix is as follows
>
> pvalue = [ NaN NaN NaN NaN;
> NaN NaN 1.00000000000000e-05 NaN;
> NaN 4.00000000000000e-05 0 NaN;
> NaN 0 0 NaN;
> NaN NaN NaN NaN];
>
> Those NaN elements are empty in the excel file. As all the pvalues are >=0, I set NaN elements to -2, and set caxis=([0 4e-5]). As -2 is out of my caxis, all the -2 elements are plotted with the minimum caxis. I want the -2 elements to be empty on the plot, like surf function does. Can anyone give me some hint on this issue? I was suggested to set a color code for -2 element, but I could not find how to set a color code to a value.
>
> Thank you very much.
> Wendy
From: Wendy on
Hi Anthony,

Thank you for your reply. The NaN are assigned blue. This makes the NaN elements and my small pvalues indistinguishable.

Wendy

"Anthony Hopf" <anthony.hopf(a)gmail.com> wrote in message <hpacfh$jcj$1(a)fred.mathworks.com>...
> Why not keep the NaN values and plot that? The NaN values will have their own color assigned to them.
>
> "Wendy " <wlq121(a)gmail.com> wrote in message <hpa86g$ngb$1(a)fred.mathworks.com>...
> > Hi all,
> >
> > I read in a matrix from xls file. The matrix is as follows
> >
> > pvalue = [ NaN NaN NaN NaN;
> > NaN NaN 1.00000000000000e-05 NaN;
> > NaN 4.00000000000000e-05 0 NaN;
> > NaN 0 0 NaN;
> > NaN NaN NaN NaN];
> >
> > Those NaN elements are empty in the excel file. As all the pvalues are >=0, I set NaN elements to -2, and set caxis=([0 4e-5]). As -2 is out of my caxis, all the -2 elements are plotted with the minimum caxis. I want the -2 elements to be empty on the plot, like surf function does. Can anyone give me some hint on this issue? I was suggested to set a color code for -2 element, but I could not find how to set a color code to a value.
> >
> > Thank you very much.
> > Wendy
From: Anthony Hopf on
How about making the NaN values very large... like 100 and limiting your color scale to 1e-5 to 1. This will set your small values to different colors and your 100 (read NaN) to the color for 1. you could also use 1e-5 to 1e-3.

T

"Wendy " <wlq121(a)gmail.com> wrote in message <hpadda$1vi$1(a)fred.mathworks.com>...
> Hi Anthony,
>
> Thank you for your reply. The NaN are assigned blue. This makes the NaN elements and my small pvalues indistinguishable.
>
> Wendy
>
> "Anthony Hopf" <anthony.hopf(a)gmail.com> wrote in message <hpacfh$jcj$1(a)fred.mathworks.com>...
> > Why not keep the NaN values and plot that? The NaN values will have their own color assigned to them.
> >
> > "Wendy " <wlq121(a)gmail.com> wrote in message <hpa86g$ngb$1(a)fred.mathworks.com>...
> > > Hi all,
> > >
> > > I read in a matrix from xls file. The matrix is as follows
> > >
> > > pvalue = [ NaN NaN NaN NaN;
> > > NaN NaN 1.00000000000000e-05 NaN;
> > > NaN 4.00000000000000e-05 0 NaN;
> > > NaN 0 0 NaN;
> > > NaN NaN NaN NaN];
> > >
> > > Those NaN elements are empty in the excel file. As all the pvalues are >=0, I set NaN elements to -2, and set caxis=([0 4e-5]). As -2 is out of my caxis, all the -2 elements are plotted with the minimum caxis. I want the -2 elements to be empty on the plot, like surf function does. Can anyone give me some hint on this issue? I was suggested to set a color code for -2 element, but I could not find how to set a color code to a value.
> > >
> > > Thank you very much.
> > > Wendy
From: us on
"Wendy " <wlq121(a)gmail.com> wrote in message <hpa86g$ngb$1(a)fred.mathworks.com>...
> Hi all,
>
> I read in a matrix from xls file. The matrix is as follows
>
> pvalue = [ NaN NaN NaN NaN;
> NaN NaN 1.00000000000000e-05 NaN;
> NaN 4.00000000000000e-05 0 NaN;
> NaN 0 0 NaN;
> NaN NaN NaN NaN];
>
> Those NaN elements are empty in the excel file. As all the pvalues are >=0, I set NaN elements to -2, and set caxis=([0 4e-5]). As -2 is out of my caxis, all the -2 elements are plotted with the minimum caxis. I want the -2 elements to be empty on the plot, like surf function does. Can anyone give me some hint on this issue? I was suggested to set a color code for -2 element, but I could not find how to set a color code to a value.
>
> Thank you very much.
> Wendy

one of the solutions

m=[
NaN NaN NaN NaN
NaN NaN 1e-005 NaN
NaN 4e-005 0 NaN
NaN 0 0 NaN
NaN NaN NaN NaN
];
m=flipud(m); % <- !!!!!
imagesc(m);
ma=~isnan(m);
alpha(double(ma));
colorbar;
colormap(jet);
axis image;
axis xy; % <- !!!!!

us