Problem with colormap command using hsv
Ältere Kommentare anzeigen
Hi There. I'm still a relatively elementary-level Matlab programmer, and I've come across a problem with a figure I'm making for my thesis. The plot is fairly complex, but the problem really shouldn't be. I have a range of data, and I tailor the colors of plot to the range that I compute (which can change each time I run my code). At the moment the range is 94 units, so I first tell my plot the color axis: caxis([MinValue MaxValue]), and then define the colormap as colormap(hsv(Range)) where Range is (MaxValue-MinValue)+1. In my experience this shouldn't be a problem, but the colormap command, which is essentially the same here as saying "make me an hsv matrix that is 94 entries down and three across" keeps spitting back this error:
Error using ==> set All colormap intensities must be between 0 and 1
Error in ==> colormap at 95 set(figH, 'Colormap', arg);
The worst part is that this error usually happens, but in some small number of cases, it doesn't, and the plot comes up just fine. I can't find any reason for this inconsistency.
I do plot a lot of other figures in my code, and I'm wondering if somehow I'm overloading the colormap command, but every time I've gone into colormap and set a setpoint at line 95, I've checked the arg and arg1 matrices it uses and none have values that are below 0 or above 1. It's a mystery to me, and I'm inclined to think it's a bug in hsv unless I'm really screwing up the use of the colormap command in the first place. I will say I've successfully used this command almost exactly as this one appears many times in the past without problem...
Any help you can give is greatly appreciated.
Best, Jonathan
1 Kommentar
Jonathan
am 16 Aug. 2013
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Color and Styling finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!