フィルターのクリア

Plot not displaying given axis limits

26 ビュー (過去 30 日間)
Samantha Boger
Samantha Boger 2020 年 10 月 17 日
回答済み: Nagasai Bharat 2020 年 10 月 20 日
When trying to plot a graph I have set the limit using the following code:
ylimit = 1.5;
ylim([-ylimit,ylimit])
axis equal
But the plot produced does not have that axis limit:
Does anyone know why this is happening and how to stop it?
  3 件のコメント
VBBV
VBBV 2020 年 10 月 18 日
編集済み: VBBV 2020 年 10 月 18 日
Or use xlim just like ylim. Ylim seems to work fine.
% if true
% code
%end
xlimit = 3;
xlim([-xlimit,xlimit])
%axis equal
Adam Danz
Adam Danz 2020 年 10 月 18 日
We don't see enough of your code to see what's causing that. It could be caused by any of these possibilities or another reason
  • The cirlce isn't complete and the axes are fine.
  • you're Setting xlim somewhere
If you're setting axis equal prior to ylim, it would also cause this problem. For example,
th = linspace(0,2*pi,100);
x = sin(th);
y = cos(th);
plot(x,y,'r-')
hold on
plot(-3.5, 0, 'g*')
axis equal
ylim([-1.5, 1.5])
grid on

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

回答 (1 件)

Nagasai Bharat
Nagasai Bharat 2020 年 10 月 20 日
Hi,
From my understanding you are trying to limit your plot axis."axis equal" command uses the same length for the data units along each axis but not exactly plot in that range.
The following resources might help you achieve your objective.

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by