2014年11月20日 星期四

繪圖之水平座標與垂直座標刻度設定

Example:

n = [-100:100];
x = cos(0.1*pi*n);
Hx = stem(n,x,'r--','filled');
set(Hx,'markersize',2);
axis([-110, 110,-2,2]);
xtick = [-100:18:100];
ytick = [-2:0.5:2];
set(gca,'XTickMode','manual','XTick',xtick);
set(gca,'YTickMode','manual','YTick',ytick);
xlabel('n','FontSize',10);
ylabel('x(n)','FontSize',10);
其中水平座標刻度設定

xtick = [刻度由此開始:刻度間隔:刻度結束]

垂直座標刻度設定亦同

ytick = [刻度由此開始:刻度間隔:刻度結束]


2014年9月3日 星期三

更改繪圖axis字型

Example

n = [0:20]; x = [(n-3) == 0];
hd = stem(n,x,'k');
axis([0,20,min(x),max(x)]);
set(get(hd,'Parent'),'FontName','times new roman')


Results

原始圖(字型為Helvetica)

更改後(字型為times new roman)




觀察繪圖區內的屬性

Example:

n = [0:20]; x = [(n-3) == 0];
hd = stem(n,x,'k');
axis([0,20,min(x),max(x)]);
get(get(hd,'Parent'))

Results:
ActivePositionProperty = outerposition
ALim = [0 1]
ALimMode = auto
AmbientLightColor = [1 1 1]
Box = on
CameraPosition = [10 0.5 17.3205]
CameraPositionMode = auto
CameraTarget = [10 0.5 0]
CameraTargetMode = auto
CameraUpVector = [0 1 0]
CameraUpVectorMode = auto
CameraViewAngle = [6.60861]
CameraViewAngleMode = auto
CLim = [0 1]
CLimMode = auto
Color = [1 1 1]
CurrentPoint = [ (2 by 3) double array]
ColorOrder = [ (7 by 3) double array]
DataAspectRatio = [20 1 2]
DataAspectRatioMode = auto
DrawMode = normal
FontAngle = normal
FontName = Helvetica
FontSize = [10]
FontUnits = points
FontWeight = normal
GridLineStyle = :
Layer = bottom
LineStyleOrder = -
LineWidth = [0.5]
MinorGridLineStyle = :
NextPlot = replace
OuterPosition = [ (1 by 4) double array]
PlotBoxAspectRatio = [1 1 1]
PlotBoxAspectRatioMode = auto
Projection = orthographic
Position = [ (1 by 4) double array]
TickLength = [0.01 0.025]
TickDir = in
TickDirMode = auto
TightInset = [ (1 by 4) double array]
Title = [182.015]
Units = normalized
View = [0 90]
XColor = [0 0 0]
XDir = normal
XGrid = off
XLabel = [183.015]
XAxisLocation = bottom
XLim = [0 20]
XLimMode = manual
XMinorGrid = off
XMinorTick = off
XScale = linear
XTick = [ (1 by 11) double array]
XTickLabel = [ (11 by 2) char array]
XTickLabelMode = auto
XTickMode = auto
YColor = [0 0 0]
YDir = normal
YGrid = off
YLabel = [184.015]
YAxisLocation = left
YLim = [0 1]
YLimMode = manual
YMinorGrid = off
YMinorTick = off
YScale = linear
YTick = [ (1 by 11) double array]
YTickLabel = [ (11 by 3) char array]
YTickLabelMode = auto
YTickMode = auto
ZColor = [0 0 0]
ZDir = normal
ZGrid = off
ZLabel = [185.015]
ZLim = [-1 1]
ZLimMode = auto
ZMinorGrid = off
ZMinorTick = off
ZScale = linear
ZTick = [-1 0 1]
ZTickLabel =
ZTickLabelMode = auto
ZTickMode = auto

BeingDeleted = off
ButtonDownFcn =
Children = [ (2 by 1) double array]
Clipping = on
CreateFcn =
DeleteFcn =
BusyAction = queue
HandleVisibility = on
HitTest = on
Interruptible = on
Parent = [1]
Selected = off
SelectionHighlight = on
Tag =
Type = axes
UIContextMenu = []
UserData = []
Visible = on


2014年7月17日 星期四

Legend中的字型與大小也能變更

Example:
>> plot(1:10,[1:10].*cos([1:10]),'-rs',1:10,[1:10].*sin([1:10]),'-.bo',...
1:10,[1:10].*cos([11:20]),'-g*',1:10,[11:20].*sin([11:20]),'-.k+',...
1:10,[1:10].*cos([21:30]),'--c>',1:10,[21:30].*sin([21:30]),'--yd')
>> h = legend('\fontname{標楷體}{隨機選取}\fontname{times new roman}{Lena}',...
'\fontname{標楷體}\fontsize{6}{隨機選取}\fontname{times new roman}\fontsize{10}{F16}',...
'\fontname{標楷體}{隨機選取}\fontname{times new roman}{Pepper}',...
'\fontname{標楷體}{非隨機選取}\fontname{times new roman}{Lena}',...
'\fontname{標楷體}{非隨機選取}\fontname{times new roman}{F16}',...
'\fontname{標楷體}{非隨機選取}\fontname{times new roman}\fontsize{8}{Pepper}');
>> xlabel('\fontname{times new roman}{\itp}')
>> ylabel('\fontname{times new roman}{\itPSNR}')