Histogram and density plot together -- does not match each other
이전 댓글 표시
Hello Good People, I have been trying to plot histogram and density plot for a certain data set. But my histogram and density plot do not agree with each other. Can anyone please help me out of this. I am using the following code:
x = rand(1,1000)';
y = randn(1,1000)';
N = hist3([x,y],bins);
N(size(N,1)+1,size(N,2)+1) = 0;
xb = linspace(min(x),max(x),size(N,1));
yb = linspace(min(y),max(y),size(N,2));
hist3([x,y],'Nbins',bins,'CDataMode','auto','FaceColor','interp')
xlabel('X')
ylabel('Y')
hold on
h = pcolor(xb,yb,N)
colormap('hot')
h.ZData = ones(size(N))*-max(max(N));
ax = gca;
ax.ZTick(ax.ZTick < 0) = [];

The picture on the left is showing the density plot and histogram together. The picture on the right is showing the the top view of the histogram. Which does not consistent with density plot on the left.
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Data Distribution Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!