How to assign the color intervals while using the jet color chart?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Can anyone please tell me how to increase the intervals betwwen the selected colors from a color chart (eg. jet or parula)? I used jet color chart to plot 16 data values but the selected colors look similar and hard to distinguish in the group plot. Can I change the shades of colors used so that they can have more distinguished colors?
x=[1 2 1 4 6 8 4 7 9 4 7 3 1 6 7 4];
y=[0.5 0.1 0.8 0.2 0.1 0.7 0.8 0.3 0.5 0.1 0.8 0.2 0.1 0.7 0.8 0.3];
c=jet(16); %Can we modify the interval between these 16 selected colors in the chart?
0 Kommentare
Akzeptierte Antwort
Voss
am 7 Mai 2022
If, by "modify the interval between" colors, you mean "use different" colors, then yes. You can use Any Colour(s) You Like. Perhaps a different built-in colormap like colorcube would be better for your objective, or you can make your own (as I've done here with the function green defined below):
cmaps = {@jet @parula @turbo @colorcube @green};
% demonstrating different colormap's colors:
nc = numel(cmaps);
for ii = 1:nc
ax = subplot(1,nc,ii);
set(ax, ...
'ColorMap',cmaps{ii}(16), ...
'Visible','off');
cb = colorbar( ...
'Position',[(ii-1+0.125)/nc 0 0.75/nc 1], ...
'YTick',[]);
set(get(cb,'Label'), ...
'Rotation',0, ...
'Position',[0.5 0.5 0], ...
'String',func2str(cmaps{ii}), ...
'FontSize',12, ...
'VerticalAlignment','middle');
end
function c = green(n)
c = zeros(n,3);
c(:,2) = linspace(0,1,n);
end
For a complete list of built-in colormaps (and how to make your own), see: colormap
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Colormaps 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!