绘图
来源:互联网 发布:雕刻机编程步骤 编辑:程序博客网 时间:2024/04/28 07:16
R绘图:
setwd("D:\\Program Files\\R\\data") #设置图的工作区间
data<-read.delim("test.txt");names(data); #读取数据源
m<-paste(levels(data$年月)[1],levels(data$年月)[length(levels(data$年月))],sep="~"); #取时间轴的区间
t<-paste(m,"年月",sep=" "); #连接时间轴区间和“年月”这两个字符串
y<-paste("价格,币别为:",levels(data$币别),sep=" "); #连接两个字符串
coplot(data$金额~data$年月|data$Product_ID,ylim=c(min(data$金额),max(data$金额)),xlab=t,ylab=y,cex=1.5) #绘制图形,不同的productId下 的横轴为年月,纵轴为金额的图
关于coplot():
函数格式如下:
coplot(formula, data, given.values, panel = points, rows, columns, show.given = TRUE, col = par("fg"), pch = par("pch"), bar.bg = c(num = gray(0.8), fac = gray(0.95)), xlab = c(x.name, paste("Given :", a.name)), ylab = c(y.name, paste("Given :", b.name)), subscripts = FALSE, axlabels = function(f) abbreviate(levels(f)), number = 6, overlap = 0.5, xlim, ylim, ...) co.intervals(x, number = 6, overlap = 0.5)
formula
a formula describing the form of conditioning plot. A formula of the form y ~ x | a
indicates that plots of y
versus x
should be produced conditional on the variablea
. A formula of the form y ~ x| a * b
indicates that plots ofy
versus x
should be produced conditional on the two variablesa
and b
.
All three or four variables may be either numeric or factors. When x
ory
are factors, the result is almost as if as.numeric()
was applied, whereas for factora
or b
, the conditioning (and its graphics if show.given
is true) are adapted.
data
a data frame containing values for any variables in the formula. By default the environment wherecoplot
was called from is used.
given.values
a value or list of two values which determine how the conditioning on a
andb
is to take place.
When there is no b
(i.e., conditioning only on a
), usually this is a matrix with two columns each row of which gives an interval, to be conditioned on, but is can also be a single vector of numbers or a set of factor levels (if the variable being conditioned on is a factor). In this case (no b
), the result ofco.intervals
can be used directly as given.values
argument.
panel
a function(x, y, col, pch, ...)
which gives the action to be carried out in each panel of the display. The default ispoints
.
rows
the panels of the plot are laid out in a rows
by columns
array.rows
gives the number of rows in the array.
columns
the number of columns in the panel layout array.
show.given
logical (possibly of length 2 for 2 conditioning variables): should conditioning plots be shown for the corresponding conditioning variables (defaultTRUE
).
col
a vector of colors to be used to plot the points. If too short, the values are recycled.
pch
a vector of plotting symbols or characters. If too short, the values are recycled.
bar.bg
a named vector with components "num"
and "fac"
giving the background colors for the (shingle) bars, fornumeric and factor conditioning variables respectively.
xlab
character; labels to use for the x axis and the first conditioning variable. If only one label is given, it is used for the x axis and the default label is used for the conditioning variable.
ylab
character; labels to use for the y axis and any second conditioning variable.
subscripts
logical: if true the panel function is given an additional (third) argument subscripts
giving the subscripts of the data passed to that panel.
axlabels
function for creating axis (tick) labels when x or y are factors.
number
integer; the number of conditioning intervals, for a and b, possibly of length 2. It is only used if the corresponding conditioning variable is not afactor
.
overlap
numeric < 1; the fraction of overlap of the conditioning variables, possibly of length 2 for x and y direction. When overlap < 0, there will begaps between the data slices.
xlim
the range for the x axis.
ylim
the range for the y axis.
...
additional arguments to the panel function.
x
a numeric vector.
- 绘图
- 绘图
- 绘图
- 绘图
- 绘图
- 绘图
- 绘图
- 绘图
- 绘图
- 绘图
- 绘图
- 绘图
- 绘图
- 绘图
- 绘图
- 绘图
- 绘图
- 绘图
- 【Js--代码模块】最精练的div移动代码
- struts1.x 标签使用总结
- Java Web中数据共享说明
- C++中的mutable和const
- Win 8台式机欲用触控鼠标代替触摸板 抽风还是有底气?
- 绘图
- 实时Web时代即将到来:不只谷歌Twitter玩得起
- SPDY 是什么?如何部署 SPDY?
- oracle的一些常用操作
- MFC ODBC
- 几个不错的在线UML图编辑器
- Js中的window.parent ,window.top,window.self 详解 .
- Linux 文件IO函数(open/close/read/write/lseek)
- 织梦(dedecms)系统常用全局变量调用标签及路径