colormap(rednblue3)
regards
dagmar
-----------------------------
function [cmap] = rednblue3(maplength);
% ColEdit function [cmap] = rednblue3(maplength);
%
% colormap m-file written by ColEdit
% version 0.1.2 on 21-Feb-2001, d.kieke
%
% input : [maplength] [64] - colormap length
%
% output : cmap - colormap RGB-value array
% set red points
r = [ [];...
[0 0];...
[0.5 1];...
[0.75 1];...
[1 0.5];...
[] ];
% set green points
g = [ [];...
[0 0];...
[0.25 0.75];...
[0.5 1];...
[0.5155 1];...
[0.75 0.75];...
[1 0];...
[] ];
% set blue points
b = [ [];...
[0 0.5];...
[0.25 1];...
[0.5 1];...
[1 0];...
[] ];
% ColEditInfoEnd
% get colormap length
if nargin==1
if length(maplength)==1
if maplength<1
maplength = 64;
elseif maplength>256
maplength = 256;
elseif isinf(maplength)
maplength = 64;
elseif isnan(maplength)
maplength = 64;
end
end
else
maplength = 64;
end
% interpolate colormap
np = linspace(0,1,maplength);
rr = interp1(r(:,1),r(:,2),np,'linear');
gg = interp1(g(:,1),g(:,2),np,'linear');
bb = interp1(b(:,1),b(:,2),np,'linear');
% compose colormap
cmap = [rr(:),gg(:),bb(:)];
I've no mapping toolbox but I had the same problem when using mesh.
As the colormap is applied to the plot inbetween it's max. and min values
(don't no how contourfm works) I wrote a function to create a colormap
according to the 2-dim matrix which is to be plotted with mesh.
For a surface like e.g.:
m=sin(i).'*(cos(j).*cos(j)-0.5)+0.25;
mesh(m);
% change to special color map
l=10;
colormap(special_colormap(m,l));
The l-parameter is the length of the color map you get - to get good looking
results
l has to be changed according to the resolution of m (size of m).
May you can't use this function but others have similar trouble.
Your're welcome,
Wolfgang
--------------------------------------------------------------------------- ma=max(max(m)); di=ma-mi; if ((mi<0) & (ma>0)) c=erg;
------------
function c=special_colormap(m,l);
% creates a color map with region arround zero
% - this unfortunately can't be made exactly
% in light green color whereas other regions are
% blue or red;
% l defines color map's approximate (!) length
% actual length is l+1 or l.
mi=min(min(m));
m1=fix(-mi/di*l);
m2=fix( ma/di*l);
% all that's smaller than 0:
erg(1:m1,:)=[(m1:-1:1).'*0 (m1:-1:1).'*0 (1:m1).'/m1];
% what is near 0 in highlighted green:
% if you want white set [1 1 1] instead of [0 1 0];
erg(m1+1,:)=[0 1 0];
% all that's greater than 0:
erg(((m1+2):(m1+1+m2)),:)=[(m2:-1:1).'/m2 (m2:-1:1).'*0 (m2:-1:1).'*0];
elseif (mi>0);
erg(1:l,:)=[(l:-1:1).'/l (l:-1:1).'*0 (l:-1:1).'*0];
elseif (ma<0);
erg(1:l,:)=[(l:-1:1).'*0 (l:-1:1).'*0 (1:l).'/l];
end;
---------------------------------------------------------------------------
------------
> I am doing anomaly plots of weather data using the mapping toolbox. I am
> using contourfm, and have a colorbar on my plot.
> What colormap (or alteration to a colormap) should I use so that positive
> values are red, and negative values are blue, with white representing 0
> (or close to it)?
> Any suggestions??
> Thanks!
> Jessica
In my example i and j have to be vectors:
i=[0:0.1:6];
j=[0:0.1:6];
Wolfgang
> I've no mapping toolbox but I had the same problem when using mesh.
> As the colormap is applied to the plot inbetween it's max. and min values
> (don't no how contourfm works) I wrote a function to create a colormap
> according to the 2-dim matrix which is to be plotted with mesh.
> For a surface like e.g.:
> m=sin(i).'*(cos(j).*cos(j)-0.5)+0.25;
> mesh(m);
> % change to special color map
> l=10;
> colormap(special_colormap(m,l));
> The l-parameter is the length of the color map you get - to get good
looking
> results
> l has to be changed according to the resolution of m (size of m).
> May you can't use this function but others have similar trouble.
> Your're welcome,
> Wolfgang
> --------------------------------------------------------------------------
--
> ------------
> function c=special_colormap(m,l);
> % creates a color map with region arround zero
> % - this unfortunately can't be made exactly
> % in light green color whereas other regions are
> % blue or red;
> % l defines color map's approximate (!) length
> % actual length is l+1 or l.
> ma=max(max(m));
> mi=min(min(m));
> di=ma-mi;
> if ((mi<0) & (ma>0))
> m1=fix(-mi/di*l);
> m2=fix( ma/di*l);
> % all that's smaller than 0:
> erg(1:m1,:)=[(m1:-1:1).'*0 (m1:-1:1).'*0 (1:m1).'/m1];
> % what is near 0 in highlighted green:
> % if you want white set [1 1 1] instead of [0 1 0];
> erg(m1+1,:)=[0 1 0];
> % all that's greater than 0:
> erg(((m1+2):(m1+1+m2)),:)=[(m2:-1:1).'/m2 (m2:-1:1).'*0 (m2:-1:1).'*0];
> elseif (mi>0);
> erg(1:l,:)=[(l:-1:1).'/l (l:-1:1).'*0 (l:-1:1).'*0];
> elseif (ma<0);
> erg(1:l,:)=[(l:-1:1).'*0 (l:-1:1).'*0 (1:l).'/l];
> end;
> c=erg;
> --------------------------------------------------------------------------
--
> ------------
> > I have what is probably a pretty simple question.
> > I am doing anomaly plots of weather data using the mapping toolbox. I
am
> > using contourfm, and have a colorbar on my plot.
> > What colormap (or alteration to a colormap) should I use so that
positive
> > values are red, and negative values are blue, with white representing 0
> > (or close to it)?
> > Any suggestions??
> > Thanks!
> > Jessica
G'day folks,
I'm currently testing the speed of the Linux implementation of Matlab.
However, I've run into a bit of an anomaly. The problem I am running is
a least squares optimisation (numerically ill-conditioned) with little
vectorisation and the results are:
HP 735 (100 MHz, 80MB Ram) 310s
P100, 16MB, Windows 360s
P100, 16MB, Linux 420s
What surprised me was the relatively good performance of the P100 against
the HP box - on the Matlab benchmarks, the p100 is approximately half the
speed (this is about what I would expect given the machines).
Any comments/ideas on the poor HP performance would be welcome.
More bad news for Linux users - not only does Linux appear slow, but
numerical stability isn't good either:
HP - excellent
Windows - poor
Linux - very poor
(subjective based on the problem I'm interested in)
I'm still chasing the stability issue - I'm not surprised by the slow
Linux speed, but I did expect significantly more robust performance than
the windows version.
Cheers
Larry
3. timing anomaly in PC-matlab
4. pre-compiled ssh for solaris x86
5. DCT and FFT anomalies, should be corrected
7. Newbie: Plotting Multiple 2-D plots to make a 3-D Plot
9. How 2 plot some 2-D-plots in a 3-D-plot ?
10. Save a plot as .png without actually plotting?
11. question: plot different dataset on a same plot
12. Plotting on top of an image using plot
13. plot for right and plot for left axes