Two colormaps on map projection

3 views (last 30 days)
Michael Madelaire
Michael Madelaire on 13 Jun 2018
Answered: Walter Roberson on 13 Jun 2018
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 Comments
Michael Madelaire
Michael Madelaire on 13 Jun 2018
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 on 13 Jun 2018
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.

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 13 Jun 2018
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

Categories

Find more on Colormaps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!