一、基本绘图函数
plot函数
基本书写格式:plot(x,y,type, main, sub,xlab,ylab. …)
plot( )的绘图形式用参数type指定,p表示绘制散点图,“1”表示绘制折线图,“b"表示绘制散点与折线的叠加图,c:去除散点后的折线图,s梯形图
main:用于指定图形的主标题
sub:用于指定图形的副标题
cex: 指定对字号的设置 如 cex.main=4
font: 指定对字体的设置. 如 font.sub=3. #斜体
pch:指定点的类型
lty:指定线条类型
col:用于指定颜色
col.axis col.lab. col.sub. col.fg col.bg分别代表指定坐标轴刻度、坐标轴标签、副标题、前景、背景的颜色
lengend( )函数——设置图例
基本书写格式
legend(x,y=NULL, legend,col=par(“col”)…)
x,y 用来指定图例的坐标位置,可选择的位置有9个,分别为"bottonright" “botton” “bottonleft” “left” “topleft” “top” “topright” “right” “center”
legend: 用来指定需要添加的图例标签
col: 指定图例的颜色
grid( )函数——设置网格线
grid(nx=NULL,ny=nx,col=“lightgray”,lty=“dotted”,lwd=par(“lad”…)