Thread Subject:
Setting a threshold value for contour plots

Subject: Setting a threshold value for contour plots

From: Chris

Date: 22 Jul, 2012 23:45:21

Message: 1 of 2

Hello,
I have experiential data values in several CSV file formats that I am looking to plot. Each CSV file contains the co-ordinates where it was collected in it's file name. What I would like to do is create a contour plot of these values while maintaining spacial accuracy.

I am currently able to maintain spatial accuracy by creating a zeros array and then inserting values at specific locations but this causes my contour plot to interpret between many values of '0' compromising the data. Is there a threshold ability for contour plots so that I can neglect the 0's or a different way you would suggest to maintain spatial accuracy? Thanks

%PDPA Data
clc
clear all
close all

PDPA_dir=sprintf('\data location\'); %loads data directory
list=dir(Pdata_dir); %reads all CSV files at a each data point

for a=3:length(list)
    filename=sprintf('%s%s',data_dir,list(a).name);
    name_string=list(a).name;
    x_coordinate(a-2,1)=str2double(name_string(1,7:8));
    z_coordinate(a-2,1)=str2double(name_string(1,4:5));
    
    data = csvread(filename, 2, 0);
    velocity_CH1=data(:,15); %reads in velocity data values
    velocity_CH1_avg(a-2,1)=mean(velocity_CH1); %averages values for each csv file
end

[X,Z]=meshgrid(x_coordinate,z_coordinate); %creates array
value=zeros(size(X)); %sets all values to 0

points=[x_coordinate, z_coordinate, velocity_CH1_avg];
for p=1:length(list)-2
   [r_x,c_x]=find(X==points(p,1));
   [r_z,c_z]=find(Z==points(p,2));
   value(r_z(1),c_x(1))=points(p,3);
end

contourf(X, Z, value)

Subject: Setting a threshold value for contour plots

From: TideMan

Date: 23 Jul, 2012 02:54:40

Message: 2 of 2

On Monday, July 23, 2012 11:45:21 AM UTC+12, Chris wrote:
> Hello,
> I have experiential data values in several CSV file formats that I am looking to plot. Each CSV file contains the co-ordinates where it was collected in it's file name. What I would like to do is create a contour plot of these values while maintaining spacial accuracy.
>
> I am currently able to maintain spatial accuracy by creating a zeros array and then inserting values at specific locations but this causes my contour plot to interpret between many values of '0' compromising the data. Is there a threshold ability for contour plots so that I can neglect the 0's or a different way you would suggest to maintain spatial accuracy? Thanks
>
> %PDPA Data
> clc
> clear all
> close all
>
> PDPA_dir=sprintf('\data location\'); %loads data directory
> list=dir(Pdata_dir); %reads all CSV files at a each data point
>
> for a=3:length(list)
> filename=sprintf('%s%s',data_dir,list(a).name);
> name_string=list(a).name;
> x_coordinate(a-2,1)=str2double(name_string(1,7:8));
> z_coordinate(a-2,1)=str2double(name_string(1,4:5));
>
> data = csvread(filename, 2, 0);
> velocity_CH1=data(:,15); %reads in velocity data values
> velocity_CH1_avg(a-2,1)=mean(velocity_CH1); %averages values for each csv file
> end
>
> [X,Z]=meshgrid(x_coordinate,z_coordinate); %creates array
> value=zeros(size(X)); %sets all values to 0
>
> points=[x_coordinate, z_coordinate, velocity_CH1_avg];
> for p=1:length(list)-2
> [r_x,c_x]=find(X==points(p,1));
> [r_z,c_z]=find(Z==points(p,2));
> value(r_z(1),c_x(1))=points(p,3);
> end
>
> contourf(X, Z, value)

Instead of zero, try replacing them with NaN.

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