声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1448|回复: 1

[绘图技巧] 关于坐标轴及绘图区的句柄操作

[复制链接]
发表于 2006-11-28 14:04 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
Axes
Box
Controls the box around the plotting area. To have a line all around the plotting area, use
        set(gca,'box','on');
Color
Defines the color of the plotting area (the axes are controlled separately):
        set(gca,'color',[1 1 1]*0.9);
sets the color to a light gray.
xcolor, ycolor, zcolor
Use these parameters to change the color of the axes and the associated tick labels:
        set(gca,'color',[1 1 1]*0.8,'xcolor','r','ycolor','b');
(this color choice is only to illustrate the potential but not a recommendation for a serious presentation)
Fontsize
Controls the fontsize of the axes tick labels (NOT the xlabel, ylabel, and title).
       set(gca,'fontsize',18);
Fontweight
Change the fontstyle to bold or back to normal:
        set(gca,'fontweight','bold');
        set(gca,'fontweight','normal');
Again, the axes labels are not affected.
Layer
Some pseudo color plots like imagesc or pcolor cover the ticks of theaxes (and gridlines, if applicable). To bring them up again, use
        set(gca,'layer','top');
Linewidth
To increase the width of an axes or grid line:
        set(gca,'linewidth',3);
Note: the width of a plot line will not change
Position
To place a the plotting area within the figure. See below ...
xdir, ydir, zdir
Can be reverse or normal:
        set(gca,'ydir','reverse');
xscale,yscale
Can be lin (linear) or log (logarithmic)
        set(gca,'xscale','log')
xaxislocation
Can be top or bottom. In certain seismic plots it looks good to havethe xaxis at the top and the vertical (y-) axis increasing downwards:
        set(gca,'xaxislocation','top','ydir','reverse')
yaxislocation
Can be left or right.
Plot
Color
To change the color of the line. Default is blue, so if yoiu want to change that after plotting do the following:
        set(h,'color',[0.2 0.9 0.314]);
Linestyle
To modify the line style. Possible options are ':' dotted, '-' solid, '--' dashed, '-.' dash-dotted
        set(h,'linestyle',':');
Linewidth
To increase the linewidth: set(h,'linewidth',10)
Marker
To change/add a marker to the plotted data, for example
        set(h,'marker','o')
to add a circle at every data point.
Markersize
You can increase the size of the marker by
        set(h,'markersize',8)
Markeredgecolor
The color of the marker can be different:
        set(h,'markeredgecolor','w'),
and separately you can set the
markerfacecolor
such that
        set(h,'marker','d','markeredgecolor','r','markerfacecolor','g');
Of course you can combine the settings into a single command:
       set(gca,'xaxislocation','top','ydir',' reverse','inverthardcopy','off')
       set(h,'linewidth',5,'marker','v','mark erfacecolor','k','markeredgecolor','r').
In case of the plotting command, you can also include these settings in the plot instructions:
       plot(xdata,ydata,'-og','linewidth',3,' markerfacecolor','r','markeredgecolor','y')
For xlabel, ylabel and title it is actually easier to set the layout when making the labels, for example
        xlabel('text','fontsize',14,...
      'fontweight','bold',...
      'color','m')
Or you can get a list of options by first creating the xlabel, and then
        get(get(gca,'xlabel'))
Then setting parameters (e.g., fontsize) goes like that
        set(get(gca,'xlabel'),'fontsize',10)
回复
分享到:

使用道具 举报

发表于 2007-3-20 16:28 | 显示全部楼层

回复 #1 lio_li 的帖子

谢谢!解决了我的问题!
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-9-24 17:09 , Processed in 0.063612 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表