Plotting multiple sets of data over the same set of discretized locations

7 visualizzazioni (ultimi 30 giorni)
Hey guys,
Here is a general overview of what I'm trying to do...
I need to plot data on an X/Y plane at distinct locations (say every 5 units I have a data point and these data points are distributed over a 100x100 square) The tricky part is, I have six different sets of intensity data that correspond to each data point and I need to display them all on the same plot to determine if there are any correlations between the intensities.
I have made six separate plots that display intensity values with different color scales (the first goes from white to red, the second from white to blue, etc...) but I need to somehow display all the plots together on the same plot without all the data overlapping on one point. Is there any way I could slightly offset every data set so you can see all the data at approximately the same location?

Risposte (2)

Seth DeLand
Seth DeLand il 18 Feb 2011
Sean, If you're specifying a different intensity for each point, then I assume that you are plotting the data point-by-point and basing the color of each point on your intensity data. With this approach you could just offset the value of the (x,y) coordinates to be slightly away from the actual point, like this:
a = rand(10,10); % Make some data
b = rand(10,10);
c = rand(10,10);
h.fig = figure;
for j = 1:10
for k = 1:10
% Loop through the data and plot each point
h.la(j,k) = line(j,k,'Marker','.','MarkerSize',20,...
'Color',[a(j,k) 1 1]);
h.lb(j,k) = line(j+0.2,k,'Marker','.','MarkerSize',20,...
'Color',[1 b(j,k) 1]);
h.lb(j,k) = line(j-0.2,k,'Marker','.','MarkerSize',20,...
'Color',[1 1 c(j,k)]);
end
end
This will work well for smaller data sets, but it might take quitea bit of time if your a,b,c are 100x100. You'll also probably need to reduce the marker size if you go to a bigger data set.

Sean
Sean il 19 Feb 2011
Seth, thank you for getting back to me. I have tried the technique you specified above but it does not really work because my intensity values occur over a huge range (from 0 to 1*10^6) and I need to define a specific range for the color scale. I have included some code below that uses my real axis values and some arbitrary intensity values. The code currently just creates three separate contour plots but I think the method you proposed is a really good idea, is there a way to replicate the concept above with the code I have below?
Thank you so much for helping me out, I really appreciate it
%Defines color ranges for plotting, there are 16 intervals for each color
Blue=[1,1,1; 0.923,0.923,1; 0.849,0.849,1; 0.780,0.780,1; 0.713,0.713,1;...
0.650,0.650,1; 0.590,0.590,1; 0.533,0.533,1; 0.478,0.478,1; 0.427,...
0.427,1; 0.378,0.378,1; 0.286,0.286,1; 0.204,0.204,1; 0.129,0.129,1;...
0.061,0.061,1; 0,0,1];
Red=[1,1,1; 1,0.923,0.923; 1,0.849,0.849; 1,0.780,0.780; 1,0.713,0.713;...
1,0.650,0.650; 1,0.590,0.590; 1,0.533,0.533; 1,0.478,0.478;...
1,0.427,0.427; 1,0.378,0.378; 1,0.286,0.286; 1,0.204,0.204;...
1,0.129,0.129; 1,0.061,0.061; 1,0,0];
Green=[1,1,1; 0.923,1,0.923; 0.849,1,0.849; 0.780,1,0.780; 0.713,1,...
0.713; 0.650,1,0.650; 0.590,1,0.590; 0.533,1,0.533; 0.478,1,0.478;...
0.427,1,0.427; 0.378,1,0.378; 0.286,1,0.286; 0.204,1,0.204;...
0.129,1,0.129; 0.061,1,0.061; 0,1,0];
Intensity_alpha100=1*10^(5.5)*rand(21,21);
Intensity_alpha002=1*10^(5.5)*rand(21,21);
Intensity_delta111=1*10^(4.5)*rand(21,21);
X=[-71.4,-64.26,-57.12,-49.98,-42.84,-35.7,-28.56,-21.42,-14.28,...
-7.14,0,7.14,14.28,21.42,28.56,35.7,42.84,49.98,57.12,64.26,71.4];
Z=[-150,-142.86,-135.72,-128.58,-121.44,-114.3,-107.16,-100.02,-92.88,...
-85.74,-78.6,-71.46,-64.32,-57.18,-50.04,-42.9,-35.76,-28.62,...
-21.48,-14.34,-7.2];
figure(2)
contourf(X,Z, Intensity_alpha100, 30,'EdgeColor','none');
xlabel('X position')
ylabel('Z Position')
title('Alpha(100) Peak Intensity')
caxis([1000 500000]);
set(gcf, 'ColorMap', Blue);
colorbar
figure(4)
contourf(X,Z, Intensity_alpha002, 30,'EdgeColor','none');
xlabel('X position')
ylabel('Z Position')
title('Alpha(002) Peak Intensity')
caxis([1000 500000]);
set(gcf, 'ColorMap', Red);
colorbar
figure(10)
contourf(X,Z, Intensity_delta111, 30,'EdgeColor','none');
xlabel('X position')
ylabel('Z Position')
title('Delta(111) Peak Intensity')
caxis([100 80000]);
set(gcf, 'ColorMap', Green);
colorbar

Community Treasure Hunt

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

Start Hunting!

Translated by