Filter löschen
Filter löschen

Tick marks on primary x and y axes

13 Ansichten (letzte 30 Tage)
Cynthia
Cynthia am 14 Nov. 2022
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')

Akzeptierte Antwort

RAGHUNATHRAJU DASHARATHA
RAGHUNATHRAJU DASHARATHA am 15 Nov. 2022
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)');

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by