MATLAB Answers

Contour - washed out values

4 views (last 30 days)
Matthew
Matthew on 8 Jun 2012
Hello,
I have values ranging from 1-1800. There are a lot of 1-10 values and very few 1800 values. When I use the contour command, it interpolates every 200 unites (200, 400, 600, etc.), thus washing out my low end numbers. I want more contour lines to show up around the 1-10 values and less around 1800. I’ve been looking through contour properties and found a few of interest – LevelStep and LevelList. From my understanding, I should be able to create an array of values to use with LevelStep, which will be used as the interpolation. However, this has not been working for me.
I was wondering how I can get more contour lines to show up around the 1-10 values and less around 1800. Is LevelStep and LevelList the right direction?
Thanks in advance! Matt

Answers (1)

Abby Skofield
Abby Skofield on 28 Jun 2012
Hi Matthew - hope you have already figured this out. LevelList is indeed where you want to go. You may also want to set the CLim. Here's an example:
% create some fake data (between 0 and 1) with outliers at 1800
x = abs(peaks);
x(5:6,5:6) = 1800;
x(15:17,15:17) = 1800;
levels = [0:.1:1 800 1700]; % manually specify where to draw contours
contour(x,'LevelList',levels);
set(gca, 'CLim',[0 1.2]); % set CLim to be the range of most of your data

Tags

Community Treasure Hunt

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

Start Hunting!