How can I change the the display, that is the way the x values look on the plot (not the x-values themselves in the code - just the way they look) to multiply them by a constant. Kind of like scaling.

 채택된 답변

Jos (10584)
Jos (10584) 2018년 1월 31일
Here is one approach:
% create plot
x=-10:2:10
y = x.^2
plot(x,y,'bo-')
% modify labels for tick marks
xticks = get(gca,'xtick')
scaling = pi
newlabels = arrayfun(@(x) sprintf('%.1f', scaling * x), xticks, 'un', 0)
set(gca,'xticklabel',newlabels)

댓글 수: 3

Thanks a lot Jos (10584). It worked for me!
This code shows some errors in the last line with delimiters.
@Maitrayee Ghosh what exact code are you using and what is the complete error message?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

질문:

2018년 1월 31일

댓글:

Rik
2020년 8월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by