Two colormaps on map projection

조회 수: 3 (최근 30일)
Michael Madelaire
Michael Madelaire 2018년 6월 13일
답변: Walter Roberson 2018년 6월 13일
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에서 Red에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by