How to re-scale the Axises when exporting "Values" from binscatter ??

3 ビュー (過去 30 日間)
Sergii Snegir
Sergii Snegir 2021 年 2 月 27 日
編集済み: Sergii Snegir 2021 年 3 月 1 日
I am using the h= binscatter(x,y,N) with N=250 to plot my data (figure 1 below). After I created it I extract counts=h.Values to plot the contour(counts) - (figure 2 below).. Thus, I have a question. How to rescale my Axises in contour plot (figure 2) to have the same values as on Figure 1????
Many thanks
Figure 1:
Figure 2 ([M,h]=contourf(counts,5);):

採用された回答

Matteo Pellegri
Matteo Pellegri 2021 年 2 月 27 日
I'm not sure I understand the question. Have you tried this?
xlim([x1 x2])
ylim([y1 y2])
  5 件のコメント
Matteo Pellegri
Matteo Pellegri 2021 年 2 月 27 日
I understand now.
You can directly change it using
set(gca,'xtick',xmin:.1:xmax)
Alternatively you can create NxN matrices using meshgrid with the values you need and then plot using contourf
[X,Y] = meshgrid(linspace(xmin,xmax,250),linspace(ymin,ymax,250))
figure()
h = binscatter(x,y,N)
figure()
d=contourf(X,Y,h.Values)
Sergii Snegir
Sergii Snegir 2021 年 2 月 28 日
編集済み: Sergii Snegir 2021 年 3 月 1 日
Dear Matteo,
thanks for the hint with set(gca,'xtick',xmin:.1:xmax).
I tried to implement it directly but in appears in wrong place and not stretched to the full axis,see image below:

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by