Thread Subject: contourf y-axis

Subject: contourf y-axis

From: Dave Smith

Date: 19 Nov, 2009 16:52:20

Message: 1 of 2

I am using the following code to produce a contourf plot:

contourf(AttInterp(:,2:44))
caxis([0 12]);
colorbar;
set(gca,'YDir', 'reverse');
title('Attenuation over CTD Station');

The problem I am having is that the y-axis plots as 0-40, in line with the number of rows of data, but I need it to go from 0-20 in 0.5 intervals, in line with what it should actually be.

Column 1 in AttInterp is the values 0-20 in 0.5 intervals, hence why contourf(AttInterp(:,2:44)) starts at column 2.

I'm pretty new to MatLab and would appreciate any help!

Subject: contourf y-axis

From: Wayne King

Date: 19 Nov, 2009 18:43:19

Message: 2 of 2

"Dave Smith" <ospa56@bangor.ac.uk> wrote in message <he3t44$l$1@fred.mathworks.com>...
> I am using the following code to produce a contourf plot:
>
> contourf(AttInterp(:,2:44))
> caxis([0 12]);
> colorbar;
> set(gca,'YDir', 'reverse');
> title('Attenuation over CTD Station');
>
> The problem I am having is that the y-axis plots as 0-40, in line with the number of rows of data, but I need it to go from 0-20 in 0.5 intervals, in line with what it should actually be.
>
> Column 1 in AttInterp is the values 0-20 in 0.5 intervals, hence why contourf(AttInterp(:,2:44)) starts at column 2.
>
> I'm pretty new to MatLab and would appreciate any help!

Hi Dave, if you look at

>>doc contourf

you can create your own X and Y axes of the proper length to use as input arguments to contourf

Z = peaks(20);
X = 0:0.5:10-0.5;
Y = 0:0.5:10-0.5;
contourf(X,Y,Z)

Wayne

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com