Contour Plot Color Scaling
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Colormaps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!