Color a .ply according to Y value

4 ビュー (過去 30 日間)
Sushmitha Kudari
Sushmitha Kudari 2020 年 3 月 8 日
コメント済み: Ameer Hamza 2020 年 3 月 9 日
I have the follwing plot that I generate: Instead of having the background be white, i want the peaks of the curves to be white and as they increase in value, I want them to get darker. Does anyone have suggestions for this. The code and data file generates is linked HERE.
  2 件のコメント
Ameer Hamza
Ameer Hamza 2020 年 3 月 8 日
where is the file 'MunkS_500Hz.shd.mat'? It is also needed to run that code.
Sushmitha Kudari
Sushmitha Kudari 2020 年 3 月 8 日
munkProfile = load('MunkS_500Hz.shd.mat');
pressureWave = munkProfile.pressure;
pressureWave = abs(pressureWave);
squished = squeeze(pressureWave);
logged = log(squished);
[X,Y]=ndgrid(1:size(logged,1),1:size(logged,2 ));
plot_mat = [X(:) Y(:) logged(:)];
[remove, ~] = find(plot_mat(:,3) == -Inf);
plot_mat(remove,:) = [];
sorted = sortrows(plot_mat, 3);
colorMat = addColor(sorted);
ptCloud_Coral = pointCloud(sorted,'Color',colorMat);
figure
pcshow(ptCloud_Coral);
Linking .mat : HERE

サインインしてコメントする。

回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 3 月 8 日
What is the current colormap, you can reverse it by flipping the colormap matrix.
figure
p = pcshow(ptCloud);
colormap(gray)
p.Colormap = flipud(p.Colormap);
  4 件のコメント
Sushmitha Kudari
Sushmitha Kudari 2020 年 3 月 9 日
It looks the same but for example I need the points at 600,0 to be white, not like this:
Ameer Hamza
Ameer Hamza 2020 年 3 月 9 日
You can create your own colormap. For example,
figure
colors = ...
[zeros(8, 3);
gray(10);
ones(12, 3)];
p = pcshow(ptCloud);
colormap(colors);
creates following figure

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeColormaps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by