How to plot a shape away from the x and y axis?

2 ビュー (過去 30 日間)
Samy Ben Thabet
Samy Ben Thabet 2018 年 10 月 10 日
編集済み: jonas 2018 年 10 月 10 日
Hi,
I want to plot shapes but I don't want them to be on the axis (I don't want to remove the axis though).
Here is my program: h=input('What shape do you want?:','s'); a=input('The length of a side is (m):'); if strcmp(h, 'square') plot([0 0 a a 0],[0 a a 0 0],'r','LineWidth',3) end

採用された回答

jonas
jonas 2018 年 10 月 10 日
編集済み: jonas 2018 年 10 月 10 日
Just adjust the axes limits
h=input('What shape do you want?:','s');
a=input('The length of a side is (m):');
if strcmp(h, 'square')
plot([0 0 a a 0],[0 a a 0 0],'r','LineWidth',3)
xlim([-a 2*a]);
ylim([-a 2*a]);
end

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by