How to scale x-axis in MatLab?

조회 수: 208 (최근 30일)
Robert  Flores
Robert Flores 2018년 4월 18일
댓글: Robert Flores 2018년 4월 18일
Hello, this may be a very simple question, but how would one scale the x-axis in MatLab? I want to have the x-axis start at -190 and end at 200, with increments of 10. I have my input data plotted, i'll attach a figure. If you can help, great!
-Robert
  댓글 수: 1
Robert  Flores
Robert Flores 2018년 4월 18일
편집: Robert Flores 2018년 4월 18일
Below is a copy of my script:
Temp = [100,75,50,25,0,-25,-50,-65,-75,-85,-100,-125,-150,-175];
Impact_Energy = [89.3,88.6,87.6,85.4,82.9,78.9,73.1,66,59.3,47.9,34.3,29.3,27.1,25];
plot(Temp,Impact_Energy,'r*')
title('Impact Energy V. Temperature')
xlabel('Temperature, measured in C')
ylabel('Impact Energy, measured in J')
xlim([-180 110])
ylim([20 90])
-Robert

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

채택된 답변

Von Duesenberg
Von Duesenberg 2018년 4월 18일
Temp = [100,75,50,25,0,-25,-50,-65,-75,-85,-100,-125,-150,-175];
Impact_Energy = [89.3,88.6,87.6,85.4,82.9,78.9,73.1,66,59.3,47.9,34.3,29.3,27.1,25];
plot(Temp,Impact_Energy,'r*')
title('Impact Energy V. Temperature') 
xlabel('Temperature, measured in C') 
ylabel('Impact Energy, measured in J')
set(gca, 'XLim', [-190, 200], 'XTick', -190:10:200,...
    'XTickLabel', -190:10:200);
  댓글 수: 2
Robert  Flores
Robert Flores 2018년 4월 18일
편집: Robert Flores 2018년 4월 18일
Thank you, this seems to help with the increments. However, would you know why the numbers are looking blurred on the x-axis. It seems to be displaying numbers on top of each other. Please refer to the attachment to see what I am saying. Does this have anything to do with the font-size of the numbers?
-Robert
Robert  Flores
Robert Flores 2018년 4월 18일
Nevermind, I just needed to stretch the image, thanks.
-Robert

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by