I want to set a graph with middle tics without number, like the picture. Also i need to enable sides ticks. How can i do it?

 採用された回答

Adam Danz
Adam Danz 2018 年 8 月 17 日
編集済み: Adam Danz 2018 年 8 月 17 日

1 投票

To turn on 'minor' ticks:
set(gca,'XMinorTick','on')
What's a side tick? Check out all the properties of ticks you can set:

6 件のコメント

Gabriel Maia
Gabriel Maia 2018 年 8 月 17 日
I want just one minortick between ticks.
Adam Danz
Adam Danz 2018 年 8 月 17 日
編集済み: Adam Danz 2018 年 8 月 17 日
figure
hA = axes;
set(hA,'XMinorTick','on')
hA.XAxis.MinorTickValues = .05:.1:1
Check out the link I provided to learn how to change the length, direction, etc of all ticks.
Gabriel Maia
Gabriel Maia 2018 年 8 月 17 日
MinorTickValues did not work here, it just showed the default XMinorTick scale in the graph. I think that is the way, but don't know what's wrong on this code.
Adam Danz
Adam Danz 2018 年 8 月 17 日
編集済み: Adam Danz 2018 年 8 月 17 日
It definitely works. I set them for my example. You'll have to set them with whatever values of xtick you already have.
For example, if your xticks are [0 4 8 12 16] you'll want to set the minor ticks to [ 2 6 10 14]. So you'll need to set the xtick and the minor ticks.
Check out the additional properties to make ticks more visible.
Gabriel Maia
Gabriel Maia 2018 年 8 月 17 日
編集済み: Gabriel Maia 2018 年 8 月 17 日
I got it now.
ax = gca;
ax.XAxis.MinorTick = 'on';
ax.XAxis.MinorTickValues = -7.5:1:7.5;
Adam Danz
Adam Danz 2018 年 8 月 17 日
I see the problem. You don't need to create another axis. You only need the axis handle of your current axis.
replace
hA = axes
with
hA = gca;
unless you already have your current axis handle available.
Also your minor ticks should be
-7.5 : 2 : 7.5

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

その他の回答 (0 件)

製品

リリース

R2017a

タグ

質問済み:

2018 年 8 月 17 日

編集済み:

2018 年 8 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by