フィルターのクリア

How to adjust axes and grid in GUI matlab? how to get more precision for example [-1 -0.5 0] other than [-1 0]

2 ビュー (過去 30 日間)
bh dhouha
bh dhouha 2015 年 4 月 3 日
編集済み: dpb 2015 年 4 月 3 日
I would like to make the axes and the grid more precise as shown in the image below but i dont know how . i would like that when i pass the cursor on a point it gives me its coordinates x and y.If this is not possible in GUI can i just adjust the axes and make them more precise? thanks :)

回答 (2 件)

Mahdiyar
Mahdiyar 2015 年 4 月 3 日
Hi dhouha
This is exactly the same as the matlab programming in M-File and you have to use the following command where exactly you plot the figure in GUI. I give you an example;
x = 1:10;
y = x .^ 2;
plot(x, y)
grid on
axis([0 20 0 15]) % axis([x_min x_max y_min y_max])
Regards,

dpb
dpb 2015 年 4 月 3 日
Presuming the handle to the axes is hAx for brevity,
xLim=xlim(hAx); % return the current x limits for the axes
set(hAx,'xtick',[xLim(1):0.5:xLim(2)]) % set the tick marks (may be _too_ dense to see all)
You can also experiment with
'XMinorGrid', 'on|off'
'XMinorTick', 'on|off'
See
doc axes % Axes Properties for details on above
For input
doc ginput
  2 件のコメント
bh dhouha
bh dhouha 2015 年 4 月 3 日
where should i exactly put this code please ? i have callbacks etc....
dpb
dpb 2015 年 4 月 3 日
編集済み: dpb 2015 年 4 月 3 日
Wherever the axes is created and/or when it needs updating if changing axes inside the callback so should reflect those changes.

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by