# Does changing the axes turn tick marks off?

1 view (last 30 days)
Haden Mattke on 9 Mar 2015
Answered: Star Strider on 9 Mar 2015
I've tried to adjust my tick marks but they don't even exist anymore. Plenty of help on how to get rid of tick marks but absolutely nothing out there on how to turn them on. My code is listed below. The end of it is really all that's relevant.
• syms x1 x2;
• y1 = x1^2;
• slope_y1 = diff(x1^2);
• slope_y2 = -1/subs(slope_y1,2);
• %y = mx+b
• %y-mx = b
• b = 4-slope_y2*2;
• y2 = slope_y2*x2+b;
• x_intercept_y2 = solve(y2,0);
• area_y1 = int(y1,0,2);
• area_y2 = int(y2,2,x_intercept_y2);
• area = area_y1+area_y2
• figure
• hold on
• x1 = 0:.01:2;
• y1 = eval(vectorize(y1));
• plot(x1,y1,'LineWidth',2,'color','b')
• x2 = 2:.01:18;
• y2 = eval(vectorize(y2));
• plot(x2,y2,'LineWidth',2,'color','r')
• x3 = (0:.01:18);
• plot(x3,0,'LineWidth',2,'color','m')
• plot([-2 20],0, 'k')
• axis([-2 20 -1 5])
• plot([-2 0],[0 0],'k')
• plot([18 20],[0 0],'k')
• plot([0 0],[-2 5],'k')
• set(gca,'Xtick',[5 10 15])
Could someone please tell me where I went wrong?
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### Answers (2)

Giorgos Papakonstantinou on 9 Mar 2015
If you want to remove the ticks from both x axis and y axis , do this:
set(gca,'Xtick',[], 'Ytick', [])
##### 3 CommentsShowHide 2 older comments
Haden Mattke on 9 Mar 2015
Thanks for taking a look. I was intending to change gridlines, not tick marks. I just needed to use {grid on}

Sign in to comment.

Star Strider on 9 Mar 2015
See Axis Properties, specifically Tick Values and Labels. I don’t see where you might have turned your tick marks off, so I would comment-out various plotting lines until I found the guilty one. One possibility to get them back is to add 'XTickLabel' to your set call:
set(gca,'Xtick',[5 10 15], 'XTickLabel',[5 10 15])
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### Categories

Find more on Grid Lines, Tick Values, and Labels in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!