2D Histograms in Planes XZ, YZ
    6 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
Hello, I am trying to get a representation similar to the one attached to this message. That is to say, I would like to represent two 2D-histogram, one in the plane XZ and the other in the plane YZ. In X and Y, the magnitude to be displayed is the same, but the thing is that the Z-axis is different. As I want to make the representation clearer, I would add additional information in the plane Z=0, that is the reason for which I have not used the 2D-histogram with two different Y-axes. It would be very nice if you could help me to solve this. Thanks in advance, Manuel.
0 Commenti
Risposta accettata
  Bjorn Gustavsson
      
 il 6 Feb 2014
        OK, here's a simple example where you plot a few pieces together...
% First some "test-data":
x = randn(500,1);
x = x-min(x)+0.5;
y = randn(500,1);
y = y-min(y)+0.5;
y = y.^1.5+1*x;  
z = exp(-abs(2*x-y)/4); % Just to get something similar to the figure linked to in your reference 
[Nx,xH] = hist(x,9);  % Histogram of X-values
[Ny,yH] = hist(y,11); % and Y
dX = gradient(xH);    % Spacing between histogram bin centres   
dY = gradient(yH); 
%%Plot stuff...
scatter3(x,y,z,15,z,'filled') % The points
for i1 = 1:length(xH), % And the X-histogram bars
  pHmyX(i1) = patch(xH(i1)+dX(i1)*[-1 1 1 -1 -1]/2,...
                    [0 0 0 0 0],...
                    [0 0 Nx(i1)*[1 1] 0],rand(1,3));         
end
for i1 = 1:length(yH),
  pHmyY(i1) = patch([0 0 0 0 0],...
                    yH(i1)+dY(i1)*0.9*[-1 1 1 -1 -1]/2,...
                    [0 0 Ny(i1)*[1 1] 0],rand(1,3));            
end
You should be able to modify and extend that to suit your needs.
HTH
0 Commenti
Più risposte (4)
  Bjorn Gustavsson
      
 il 6 Feb 2014
        Well, have you tried what Walter suggested in his reply in the thread you linked to? Should work, then with the 2 histograms in the XZ and YZ planes you can continue to plot whatever you wanted...
HTH
Vedere anche
Categorie
				Scopri di più su Data Distribution Plots in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!