How to change both the axis value ranges

3 次查看(过去 30 天)
Hi everyone,
I have plotted this for my mobile users distribution but i don't know how to change the axis on this figure now as i want them to correspond to distance, like instead of -1 to 1 they should read as 0 to 250 km on both the axes.

采纳的回答

Mischa Kim
Mischa Kim 2014-6-16
编辑:Mischa Kim 2014-6-16
Aftab, you could simply
data_km = 125 * (data + 1);
where data would be your current one ranging from -1 to +1 and assuming a linear translation is justified. Make sure to scale both x- and y-data.
  1 个评论
Aftab Ahmed Khan
Aftab Ahmed Khan 2014-6-16
编辑:Aftab Ahmed Khan 2014-6-16
Hi Mischa, Awesome, why this idea doesn't pop up in my mind. Worked, Cheers.

请先登录,再进行评论。

更多回答(1 个)

Sean de Wolski
Sean de Wolski 2014-6-16
编辑:Sean de Wolski 2014-6-16
Set the 'XTick' and 'XTickLabel' manually
sphere
set(gca,'XTick',linspace(-1,1,6))
set(gca,'XTickLabel',cellstr(strcat(num2str((0:50:250).'),' km')))

类别

Help CenterFile Exchange 中查找有关 Formatting and Annotation 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by