change scaling of x-axis

29 vues (au cours des 30 derniers jours)
Don
Don le 15 Sep 2017
Commenté : Star Strider le 15 Sep 2017
I have data in IDCount(1,:) that goes from 0 to, say, 260. I want to rescale so the x-axis will appear in seconds -- IDCount(1,:)/140. Cannot see how to do this

Réponse acceptée

Star Strider
Star Strider le 15 Sep 2017
Try this:
x = 0:260; % Create Data
y = rand(size(x)); % Create Data
figure(1)
plot(x, y)
xt = get(gca, 'XTick'); % 'XTick' Values
set(gca, 'XTick', xt, 'XTickLabel', xt/140) % Relabel 'XTick' With 'XTickLabel' Values
The set call relabels the 'XTick' values with the same values divided by 140.
  2 commentaires
Don
Don le 15 Sep 2017
Thank you! That fixed it
Star Strider
Star Strider le 15 Sep 2017
As always, my pleasure!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Axes Appearance dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by