Matlab Graphics: Setting and Labelling Axis Ticks

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Matlab Graphics: Setting and Labelling Axis

Ticks
Notes:
By using xTick, xTickLabel, yTick, and yTickLabel you can position and label tick
marks along the axes. These dene where the grid lines are when grid is on.
Example Script:
% Script File: ShowTicks
% How to set and label axis ticks.
close all
x = linspace(0,4*pi);
y = sin(x);
plot(x,y)
axis([0 4*pi -1.2 1.2])
% Define x-ticks and their labels..
set(gca,xTick,0:pi/2:4*pi)
set(gca,xTickLabel,{0, , pi, , 2pi, , 3pi, , 4pi})
% Define y-ticks and let them be auto-labelled...
set(gca,yTick,-1:.5:1)
grid on
shg
Output:
0 pi 2pi 3pi 4pi
1
0.5
0
0.5
1

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy