Filter löschen
Filter löschen

2D Contour colormap too dark.

6 Ansichten (letzte 30 Tage)
Marc Jakobi
Marc Jakobi am 5 Sep. 2013
Kommentiert: Rachel Baker am 19 Aug. 2016
Hi.
I have a problem. I made a colormap matrix "b" by picking out the rgb colour codes using Photoshop.
However, the Matlab GUI contour appears to be a lot darker than the initial excel contour it is based upon.
I have managed to change the brightness as follows (.x, .y, .z etc. being the rgb codes)
b = [.x .y .z; .w .v .u;...];
colormap(b);
brighten(0.6) %anything lower is far too dark,
%anything higher is extremely bright
The brighten function only changes the brightness of the contour, but even with the ideal brightness it has this greyed out touch to it.
Here is a comparison:
Any tips would be much appreciated!
Marc
  6 Kommentare
Marc Jakobi
Marc Jakobi am 6 Sep. 2013
Rachel Baker
Rachel Baker am 19 Aug. 2016
Hi,
I had a very similar problem, and ended up solving it with one line:
caxis([MIN MAX])
You can set your colormap over a specific range so that the colors that are "too" dark are associated with values outside of the range you are plotting. Hope this helps someone else!
-Rachel

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Sven
Sven am 6 Sep. 2013
Bearbeitet: Sven am 6 Sep. 2013
Hi Marc,
Got it. The RGB values you're copying in are 8-bit RGB colours of integers ranging from 0 to 255. You're right that MATLAB defines its RGB colours as double values from 0 to 1, but in order to get a true conversion you should just divide the integers by 255, rather than copy them in as 0.xxx. Using 0.xxx, the "brightest" number you'll get is 0.255, which is still about one quarter as bright as the true brightest value of 1.
Try this:
b = [.091 .153 0;...
.114 .159 0;...
.137 .166 .001;...
.160 .172 .001;...
.184 .178 .001;...
.207 .184 .001;...
.230 .191 .002;...
.253 .197 .002;...
.253 .181 .003;...
.253 .166 .005;...
.253 .150 .006;...
.254 .134 .007;...
.254 .118 .008;...
.254 .103 .010;...
.254 .087 .011];
b2 = b*1000; % Get them back to whole numbers from 0 to 255
b2 = b2/255; % Transform them from [0 255] to [0 1]
figure, peaks; colormap(b)
figure, peaks; colormap(b2)
Or, more directly you can simply copy in your values without the leading decimal point (so that they will be whole integers up to 255), then divide them by 255.
Did that sort things out for you?
  1 Kommentar
Marc Jakobi
Marc Jakobi am 6 Sep. 2013
Wow, thanks! That did it. I wondered why Matlab used decimals, but just dividing the true values never occurred to me.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Lighting, Transparency, and Shading finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by