Does changing the axes turn tick marks off?
조회 수: 2 (최근 30일)
이전 댓글 표시
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
답변 (2개)
Giorgos Papakonstantinou
2015년 3월 9일
If you want to remove the ticks from both x axis and y axis , do this:
set(gca,'Xtick',[], 'Ytick', [])
댓글 수: 3
Giorgos Papakonstantinou
2015년 3월 9일
편집: Giorgos Papakonstantinou
2015년 3월 9일
Sorry I understood the opposite. When I execute your code I see tick marks at exactly where you want them i.e. 5, 10, 15
Star Strider
2015년 3월 9일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Two y-axis에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!