lio_li 发表于 2006-11-28 14:04

关于坐标轴及绘图区的句柄操作

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',*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',*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',);
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)

zjjliubing 发表于 2007-3-20 16:28

回复 #1 lio_li 的帖子

谢谢!解决了我的问题!
页: [1]
查看完整版本: 关于坐标轴及绘图区的句柄操作