How can i set middle tick?

4 views (last 30 days)
Gabriel Maia
Gabriel Maia on 17 Aug 2018
Edited: Gabriel Maia on 17 Aug 2018
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?

Accepted Answer

Adam Danz
Adam Danz on 17 Aug 2018
Edited: Adam Danz on 17 Aug 2018
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 Comments
Gabriel Maia
Gabriel Maia on 17 Aug 2018
Edited: Gabriel Maia on 17 Aug 2018
I got it now.
ax = gca;
ax.XAxis.MinorTick = 'on';
ax.XAxis.MinorTickValues = -7.5:1:7.5;
Adam Danz
Adam Danz on 17 Aug 2018
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

Sign in to comment.

More Answers (0)

Tags

Products


Release

R2017a

Community Treasure Hunt

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

Start Hunting!