how to set the axis in matlab to actual data min and max

18 ビュー (過去 30 日間)
Tadgh Cullen
Tadgh Cullen 2015 年 6 月 19 日
コメント済み: Mike Garrity 2015 年 6 月 19 日
I'm plotting data and the x and y axis are setting the min and max to 0 and 300 but the actual data min and max is -6.1686 and -6.06 respectively. I've attached three images showing what I get, proving the min and max values and finally the expected axis labels.
Would really appreciate some help on how to solve this. Even if there is a manual way to set this and keep the generated image in position.
  4 件のコメント
arun
arun 2015 年 6 月 19 日
Could u attach the 25mGridData.mat file
Mike Garrity
Mike Garrity 2015 年 6 月 19 日
The issue is that you haven't told contourf what your X coordinates are. The contourf command has a form which takes 3 args:
contourf(X,Y,V)
If you omit the first two, then it just uses the row and column indices of V as the X & Y coordinates.
I'm not entirely sure what your data looks like, but I would expect your calls to contourf to look something like this:
contourf(x,y,x)
% ...
contourf(x,y,y)

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

採用された回答

Image Analyst
Image Analyst 2015 年 6 月 19 日
See if you can use the actual y min and max in ylim() to override the default y axis range:
yMin = min(y(:));
yMax = max(y(:));
ylim([yMin, yMax]);

その他の回答 (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