Color "Thermometer" for different shaded functions
4 次查看(过去 30 天)
显示 更早的评论
Hi
I have a page of subplots each of which contains a function (a distribution to be more precise). Now each function has a different shade of color according to a certain property. Lets say the more a distribution diverges from a normal the more redish it becomes. What I want to plot next to these subplots now is sort of a thermometer with this color progression where it would be marked at the start of this thermometer "lowest divergence from normal" and at the end "highest convergence ..." etc. Of course it should not look like a real thermometer - how could I do that?
Thanks
0 个评论
回答(1 个)
Image Analyst
2013-2-4
You could use one of the built-in colormaps, such as jet, hot, winter, etc. to get your color:
% Create a color map.
thePlotsColorMap = jet(256);
% Calculate your "temperature"
theTemp = whatever....
% Normalize it to 1-256.
colorMapIndex = 256 * (theTemp - minTemp) / (maxTemp - minTemp);
% Get this particular color out of the color map.
colorToPlotWith = jet(colorMapIndex);
% Now call plot with the 'Color' option set to this
plot(x, y, 'Color', colorToPlotWith);
5 个评论
Image Analyst
2013-2-4
I don't want your code, just the screenshots. http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subplots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!