Two colormaps on map projection

2 次查看(过去 30 天)
Hi
I would like to create a map projections
load coast
figure('units','normalized','outerposition',[0 0 1 1], 'Color','w');
worldmap([30, 90], [-180, 180])
plotm(lat, long, 'k', 'LineWidth', 1.4);
With a two different data-sets on it (using scatterm). I have attached two data-sets "A" and "B".
hold on;
scatterm(A(:,1), A(:,2), 100, A(:,3), 'filled');
c = colorbar;
colormap jet
c.Label.String = 'Magnetic field in Z [nT]';
scatterm(B(:,1), B(:,2), 100, B(:,3), 'filled', 's');
But I need a second colormap and colorbar. I did find ways to do this, by making a new XY-axis and making it invisible. But this is not possible with map projections.
Thanks in advance.
  3 个评论
Michael Madelaire
Michael Madelaire 2018-6-13
Good idea! The quick answer is: No is does not work. Error ->
Error using matlab.graphics.chart.primitive.Scatter/set
Error setting property 'CData' of class 'Scatter':
Value must be a scalar, vector or array of numeric type
\n
Error in freezeColors (line 157)
set(hh,'CData',realcolor);
But I will take a better look at it later.
Walter Roberson
Walter Roberson 2018-6-13
Ah yes, you hit a bug in freezeColors for hg2. I emailed a detailed description of the problem to the author back in March but I did not receive a reply.

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson 2018-6-13
load coast
figure('units','normalized','outerposition',[0 0 1 1], 'Color','w');
worldmap([30, 90], [-180, 180])
plotm(lat, long, 'k', 'LineWidth', 1.4);
hold on
cmapA = jet;
Acolor = squeeze(ind2rgb(im2uint8(mat2gray(A(:,3))),cmapA));
scatterm(A(:,1), A(:,2), 100, Acolor, 'filled');
caxis([min(A(:,3)),max(A(:,3))]);
cA = colorbar('westoutside');
cA.Label.String = 'Magnetic field in Z [nT]';
cA.Colormap = cmapA;
cA.LimitsMode = 'manual';
cmapB = copper;
Bcolor = squeeze(ind2rgb(im2uint8(mat2gray(B(:,3))),cmapB));
scatterm(B(:,1), B(:,2), 100, Bcolor, 'filled', 's');
caxis([min(B(:,3)),max(B(:,3))]);
cB = colorbar('eastoutside');
cB.Label.String = 'Orgone energy in bions';
cB.Colormap = cmapB;
cB.LimitsMode = 'manual';
hold off

类别

Help CenterFile Exchange 中查找有关 Colormaps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by