Plot.i want my Y axis...

조회 수: 5 (최근 30일)
oner
oner 2013년 1월 2일
I plot a graph.its y axis is between -0.5 and 0.5. But i want it between -1 and 1.like this -1 , -0.8 , -0.6 , -0.4 , -0.2 , 0 , 0.2 , 0.4 , 0.6 , 0.8 , 1. Thank you in advance

답변 (2개)

Walter Roberson
Walter Roberson 2013년 1월 2일

Mark Mikofski
Mark Mikofski 2013년 1월 2일
See help for ylim to set the y-axis limits:
ylim([YMIN, YMAX])
or in your case
ylim([-1, 1])
then to set the tick marks use the set and get methods for the current axis. See help on gca, axes and axes properties:
plot(x,y); % assuming you have some data to plot called X and Y
set(gca, 'YTick', [-1:0.2:1], 'YLim', [-1, 1]) % set the y-axis limits too
gca is a handle to the current axes. You may need to click on the plot in the figure you want to edit.
You can also use MATLAB's gui Plot Tools by clicking on the "Show Plot Tools and Dock Figure" button on the toolbar, usually the last one on the right. You could also access this from the menu bar: Edit > Axes Properties..., which does the same thing. Then select the Y Axis tab and set teh limits and click the Ticks button to set the ticks.
Explore the figure and use the help docs, and you will find many ways to achiev your goal. Good luck!

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by