# how to find the length between two ticks ?

4 views (last 30 days)
Samaneh Arzpeima on 23 Jan 2019
Edited: Samaneh Arzpeima on 24 Jan 2019
Hello Everybody
I am trying to plot a scale on my graph,I did it with the help of my last question
now to plot the value on my horizontal line on the sclae(left top , ? cm/s) I need to have the length between each plot(interval). how many mm or cm is between data on point 0km and point 5km(interval between ticks).I don't know how to find this length!
Then I probably need to find the max of each data and divide it to this lenght. I suppose this will give me the answer for ?m/s
Thank you

KSSV on 23 Jan 2019
Read about imdistline. With this you can get the distance interactivley....If you want by code..you need to pick the points and use distance formula.
KSSV on 23 Jan 2019
huumh...then ginput ..what daata you have in hand by the way?

Samaneh Arzpeima on 23 Jan 2019
Edited: Samaneh Arzpeima on 23 Jan 2019
this is a 2d figure but it actually has 3 parametrs. I am trying to plot time history of velocity on specific point of space.
t=time(:,1); %10000*1
y=alongstrike(1,:); %1*41 (-100:5:100)
hold all
figure()
for i=1:41
plot((sliprate(:,i).*20+alongstrike(1,i)),time(:,i)) %sliprate is 10000*41
end
ylim([0 100])
set(gca,'Xdir','reverse')
xlabel('Strike direction (km)','FontSize',12)
ylabel('Time (s)','FontSize',12)
hold on
plot([80; 85], [110; 110], '-k', [80; 80], [110; 120], '-k', 'LineWidth', 2)
hold off
axis([[-110 110] 0 120])
text(82,115, '10 s', 'HorizontalAlignment','right')
text(88,107, '? cm/s', 'HorizontalAlignment','center')
set(gca, 'YTick', [0:20:100])
hold on
plot([60; 80], [10; 15], '-k', [60; 80], [10; 25], '-k','LineWidth', 2)
hold off
text(85,28, '2 km/s', 'HorizontalAlignment','center')
text(85,18, '4 km/s', 'HorizontalAlignment','center')
now need to plot the scale on figure.

### Categories

Find more on Labels and Annotations 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!

Translated by