A question about adjustment the Histogram2 Properties

10 ビュー (過去 30 日間)
BN
BN 2021 年 12 月 8 日
コメント済み: BN 2021 年 12 月 8 日
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
  1 件のコメント
BN
BN 2021 年 12 月 8 日
Thank you so much.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeHistograms についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by