Code to zoom in 2D plot?

5 ビュー (過去 30 日間)
Marius Brettner
Marius Brettner 2017 年 10 月 17 日
編集済み: Stephen23 2017 年 10 月 17 日
Hey!
I did a kind of "Live View" for my vehicle model in Simulink. Now I dont want the Plot (showing the car drive) to zoom out when the car drives (car will get to small to see anything). Better the window moves with the car so the car is allways in the center of the plot and can´t drive out of it :D
So the question is: how is the code to zoom in the 2D plot?
For example when the car is at x=30 and y=23 and I dont want to see the whole race track like x and y from 0 to 200. I just want the car in a 10 meter "window". So I want to zoom the window to x=25 to x=35 and y=18 to y=28. I bet this is possible with one line of code, but I cant think how.
I hope you understood my Question and maybe know how to do it. Many thanks to everyone reading this!!
Marius

採用された回答

Stephen23
Stephen23 2017 年 10 月 17 日
編集済み: Stephen23 2017 年 10 月 17 日
Simply set the X and Y limits of the axes properties:
set(axes_handle,'Xlim',[...],'YLim',[...])

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by