How to increase contrast of a 3d plot? Should I set colorbar to log scale?

조회 수: 17 (최근 30일)
Hi all,
I have the following code to plot a structure with y-displacement as ColorMapData ('node.mat', 'elem.mat', 'phiOri.mat' are attached):
clear; clc;
load('node.mat', 'node');
load('elem.mat', 'elem');
load('phiOri.mat', 'phiOri')
dis = reshape(phiOri(:, 1), [3, 3146]);
dis = dis';
scaleFactor = 1;
pdeplot3D(node, elem, 'ColorMapData', abs(dis(:, 2)));
colormap jet
axis image
The image is like this:
As you can see the majority of displacement are small, thus most of the structure are blue. Is there a way to enhance the contrast, i.e. enhance the display of region [0 0.06], such that change in the colormap are clearer?
I think change colorbar to log scale may achieve what I want, but I don't know how to do this, please help! Thanks in advance!

채택된 답변

Akshay Khadse
Akshay Khadse 2018년 9월 12일
Instead of modifying the colormap scale, you could take a log of the ColorMapData values to magnify your data variations.
I tried out the following snippet:
pdeplot3D(node, elem, 'ColorMapData', 10+log10(abs(dis(:, 2))));
Please refer to the documentation of the ' colormap ' function if you still need to modify the color scales. You can generate logarithmically spaced vectors by using ' logspace ' and then construct colormap matrices using those.

추가 답변 (0개)

카테고리

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