Clear Filters
Clear Filters

Contour Plot Color Scaling

6 views (last 30 days)
James
James on 24 May 2013
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?

Answers (0)

Categories

Find more on Contour Plots 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!