필터 지우기
필터 지우기

Contour Plot Color Scaling

조회 수: 6 (최근 30일)
James
James 2013년 5월 24일
I have a function dependant on variables A and B. I want to plot the values on a filled contour plot with A,B as the x,y axes.
The code is something like this:
A=[0:0.1:1];
B=[0:0.1:1];
figure
[X,Y]=meshgrid(A,B);
Z=function(A,B);
contourf(X,Y,Z);
colorbar;
Since the values of Z (the data) are from around -1 to +1 the contour plot is fine and can easily see the variations.
However setting the range of B (or A) to B=[0:0.01:1] as required to improve accuracy results in a few odd values being much larger (near 100) which completely skews the contour plot so I just end up with a red point there and everything else blue (indicating near zero) meaning I can no longer distinguish these small variations between most of the data points. The colorbar also indicates this new range linearly, as expected but not ideal.
I thought about taking log of the data? or just for Z? Something like:
figure
[X,Y]=meshgrid(A,B);
Z=function(A,B);
contourf(X,Y,log(Z));
colorbar;
But this gives me all sorts of errors. I don't know how to properly do this.
Is this the way to go to fix the issue? Or if not what's another way?

답변 (0개)

카테고리

Help CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by