Different color scale?

52 views (last 30 days)
Ara
Ara on 25 Nov 2024 at 11:04
Commented: Ara ongeveer 4 uur ago
Dear all,
I have two different dataset one in txt format (ROTI output) and another in xlsx format(S4 output).I wanted to plot different scalebar with different color so that I can recognize these two data set. Would you please tell me the command of it?
Thank you,
Aramesh
  4 Comments
Mathieu NOE
Mathieu NOE ongeveer 21 uur ago
hello @Ara
it would help us (and you BTW) if you could share a working code and the data
all the best
Ara
Ara ongeveer 7 uur ago
Hi Mathieu NOE,
Thank you for your comment. Unfortunately, I cannot share the data.
Best wishes,

Sign in to comment.

Answers (2)

Image Analyst
Image Analyst ongeveer 18 uur ago
You need to use the colormap function to set the colormap for each axes independently. So display one image, set the colormap, then display the other and call colormap again with the other colormap. If you're plotting line curves instead of displaying images, there is a 'Color' (or maybe 'LineColor' option in plot to let you set the specific color of each curve.
help colormap
colormap - View and set current colormap This MATLAB function sets the colormap for the current figure to the specified predefined colormap. Set Colormap colormap map colormap(map) colormap(target,map) cmap = colormap(___) Get Current Colormap cmap = colormap cmap = colormap(target) Input Arguments map - Colormap for new color scheme colormap name | three-column matrix of RGB triplets | 'default' target - Target Figure object | Axes object | PolarAxes object | GeographicAxes object | standalone visualization Output Arguments cmap - Colormap values three-column matrix of RGB triplets Examples openExample('graphics2/ChangeColormapUsedForPlotExample') openExample('graphics2/ChangeColormapThenSetItBackToDefaultExample') openExample('graphics/ColormapSpecifyAxesTiledLayoutExample') openExample('graphics2/SpecifyNumberOfColorsForColormapExample') openExample('graphics2/CreateCustomColormapExample') openExample('graphics2/ReturnColormapValuesUsedInPlotExample') openExample('graphics/ColormapReturnFromTiledLayoutExample') openExample('graphics2/ChangeColormapForFigureWithImageExample') See also colorbar, ind2rgb, hsv2rgb, rgbplot, Colormap Editor Introduced in MATLAB before R2006a Documentation for colormap doc colormap
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
  1 Comment
Ara
Ara ongeveer 6 uur ago
Dear Image analysis,
Thank you for your response. I did this but still same color bar. And, please see atatched the figure.
I would appreciate if you help me to modefy the code?
Best.
% Add colorbar for S4
colormap(ax1, jet);
c1 = colorbar('Location', 'eastoutside');
c1.Label.String = 'S4';
caxis(ax1, [0 0.3]); % Set color axis limits for S4
% Create another map for ROTI
ax2 = worldmap(latlim, lonlim); % Axis for ROTI
setm(ax2, 'FFaceColor', 'none'); % Make the background transparent
load coastlines
geoshow(coastlat, coastlon, 'DisplayType', 'polygon', 'FaceColor', [0.6 0.8 0.6]);
hold on; % Allow overlay of ROTI data
% Plot ROTI data
idx = filtered_time_hours_all >= (i-1)*5/60 & filtered_time_hours_all < i*5/60;
if any(idx)
scatterm(all_lat(idx), all_lon(idx), 10, all_roti(idx), 'filled', 'Marker', 's');
% Add colorbar for ROTI
c2 = colorbar('Location', 'westoutside');
c2.Label.String = 'ROTI (TECU/min)';
caxis(ax2, [0 0.5]); % Set color axis limits for ROTI
end

Sign in to comment.


Walter Roberson
Walter Roberson ongeveer 19 uur ago
caxis([0 0.3]);
That is affecting the current axis.
caxis([0 0.5]);
That too is affecting the current axis. Which appears to be the same axis as before.
Each axis has only one CLim axis property, so only one caxis() can be in effect at the same time in each axis.
If you need two different caxis() then you need two different axes.
  4 Comments
Rik
Rik ongeveer 2 uur ago
You're aware you didn't set a colormap for ax2?
Ara
Ara ongeveer 4 uur ago
It means that I need to add it here like this. What to write instaed of "jet" to make a difference between them?
% Add colorbar for ROTI
colormap(ax2, jet);
c2 = colorbar('Location', 'westoutside');
c2.Label.String = 'ROTI (TECU/min)';
caxis(ax2, [0 0.5]); % Set color axis limits for ROTI
end

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!