How to change both the axis value ranges
조회 수: 1 (최근 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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/164403/image.png)
댓글 수: 0
채택된 답변
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개)
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')))
댓글 수: 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!