Plotting multiple sets of data over the same set of discretized locations
5 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
回答(2 个)
Seth DeLand
2011-2-18
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Colormaps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!