Does changing the axes turn tick marks off?
4 ビュー (過去 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!