Tick marks on primary x and y axes
조회 수: 24 (최근 30일)
이전 댓글 표시
I'm trying to create a plot where there's only tick marks on the bottom x axis and left y axis, but everything I've tried thus far just produces tick marks on all sides. Please not that the y axis is meant to go in descending order. Thanks!
Here is the code I currently have for the plot:
figure(1);
plot(h, n, "k");
set(gca,'YDir','reverse', 'TickDir', 'out');
xlabel('Distance (cm)');
ylabel('Time (min)');
axis square;
box on
set(gcf, 'Color', 'w')
댓글 수: 0
채택된 답변
RAGHUNATHRAJU DASHARATHA
2022년 11월 15일
As per my understanding you want to remove tick marks on top x axis and right y axis .
I will try to demonstrate using the below example.
a=1:10;
b=1:10;
figure;
plot(a, b, "k");
h=gca;
set(h, 'TickDir', 'out','box','off','color','none')
c=axes('Position',h.Position,'box','on','xtick',[],'ytick',[]);
axes(h)
linkaxes([h c])
xlabel('Distance (cm)');
ylabel('Time (min)');
댓글 수: 1
Madmad
2024년 9월 17일
Coming back to this answer that worked well: How to keep my figure invisible if I set figure('visible','off')? Calling axes(h) makes my figure visible, which I don't want to happen. I have to recall set(gcf), so no problem, I was just wondering if there is an option to keep it invisible when calling axes(h).
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!