A question about adjustment the Histogram2 Properties

10 次查看(过去 30 天)
Hello all, Do you know how to:
A: Delete the black line around each square of left side figure ( to be similar to the right side figure)
B: change the square size of left side figure to the size of the right side figure?
Here is my script to generate both of these figures, for two different datasets:
Rights side figure:
h = histogram2(X,Y,'DisplayStyle','tile','ShowEmptyBins','off');
colormap turbo(40)
caxis([10,90])
xlim([0 500])
ylim([0 500])
Left side figure:
h = histogram2(X,Y,'DisplayStyle','tile','ShowEmptyBins','off');
colormap turbo(40)
caxis([10,90])
xlim([0 1000])
ylim([0 1000])

采纳的回答

Dave B
Dave B 2021-12-8
编辑:Dave B 2021-12-8
For the first bit, you can set the EdgeColor to 'none'.
For the second bit, getting 'squares' depends on both the fact that bins that you've used for the histogram and the aspect ratio of your axes. If you use equal sized bins and axis equal, you should be in good shape. To adjust the size of the bins, just specify the values for the bin edges:
x=randn(10000,1);
y=x+randn(10000,1);
xbins=linspace(-5,5,30);
ybins=linspace(-5,5,30);
histogram2(x,y,xbins,ybins,'DisplayStyle','tile','EdgeColor','none')
grid off
axis equal

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Histograms 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by