【发布时间】:2013-08-07 10:40:08
【问题描述】:
我正在 Matlab 中绘制一些数据,当我在绘图中添加颜色条时,范围标签会重复绘制到绘图中。这是一个最小的工作示例:
events = 1000000;
x1 = sqrt(0.05)*randn(events,1)-0.5; x2 = sqrt(0.05)*randn(events,1)+0.5;
y1 = sqrt(0.05)*randn(events,1)+0.5; y2 = sqrt(0.05)*randn(events,1)-0.5;
x= [x1;x2]; y = [y1;y2];
%For linearly spaced edges:
xedges = linspace(-1,1,64); yedges = linspace(-1,1,64);
histmat = hist2(x, y, xedges, yedges);
figure; pcolor(xedges,yedges,histmat'); colorbar ; axis square tight ;
你可以从这里获得hist2-function:
http://www.mathworks.com/matlabcentral/fileexchange/9896-2d-histogram-calculation/content/hist2.m
这是我运行代码得到的结果:
如果我从上面的代码中删除颜色条命令,我会得到:
任何想法为什么会出现这个问题?我以前也遇到过这个问题... 我的操作系统是 64 位 Windows 7 Enterprise,我有 Matlab R2012b (8.0.0.783)
感谢您的帮助:)
【问题讨论】:
-
+1 @nkjt 做到了 :)
标签: matlab plot visualization colorbar