嗨R用户和程序员,我有一个由4563个氨基酸的蛋白质组成的数据集.使用三种不同的处理和两种不同的氧化剂,该蛋白质中的氨基酸被氧化.我想根据治疗情况在图表中绘制这些氧化的位置.不同的线尺寸将代表不同的氧化剂浓度,线型(虚线和实线)将代表不同类型的氧化剂.我想在每1000个氨基酸处打破轴心.我用excel和gimp创建了一个类似的模板(相当耗时且可能不合适!).模板中的0.33是行高. http://dl.dropbox.com/u/58221687/Chakraborty_Figure1.png.这是数据集:http: //dl.dropbox.com/u/58221687/AA-Position-template.xls
提前致谢.Sourav
这是我的代码和相关的变量结构.
Correlation_Plot = contourplot(cor_Warra_SF_SST_JJA, region=TRUE, at=seq(-0.8, 0.8, 0.2),
labels=FALSE, row.values=(lon_sst), column.values=lat_sst,
xlab='longitude', ylab='latitude')
Correlation_Plot = Correlation_Plot + layer({ ok <- (cor_Warra_SF_SST_JJA>0.6);
panel.text(cor_Warra_SF_SST_JJA[ok]) })
Correlation_Plot
# this is the longitude (from -179.5 to 179.5) , 360 data in total
> str(lon_sst)
num [1:360(1d)] -180 -178 -178 -176 -176 ...
# this is the latitude (from -89.5 to 89.5), 180 data in total
> str(lat_sst)
num [1:180(1d)] -89.5 -88.5 -87.5 -86.5 -85.5 -84.5 -83.5 -82.5 -81.5 -80.5 ...
# This is data …Run Code Online (Sandbox Code Playgroud) 我有类似以下数据:
X <- 1:20
B <- c(1,4,6,3,1, 4, 5,8,8,6,3,2,1, 1,5,7,8,6,4,2)
C <- B + 4
myd <- data.frame (X, B, C)
Run Code Online (Sandbox Code Playgroud)
我希望在曲线内用不同的颜色着色.请注意x中的边界颜色填充
region 1 = 1 to 6
region 2 = 6 to 16
region 3 = 16 to 20
Run Code Online (Sandbox Code Playgroud)

这可能是一个非常基本的问题,但我在一个xyplot中在Lattice中苦苦挣扎,我绘制了曲线和回归线(类型"r",类型"l"),以给每一行提供不同的颜色.
我已经基本上尝试了下面的代码和?cars数据集.
xyplot(speed ~ dist, data=cars, type=c("r", "l"),
col=c("red", "black"),
auto.key=list(lines=TRUE))
Run Code Online (Sandbox Code Playgroud)
问题是它绘制了两条线,但它们都是红色的....
我有一个看起来像这样的数据集
VegType 87MIN 87MAX 87Q25 87Q50 87Q75 96MIN 96MAX 96Q25 96Q50 96Q75 00MIN 00MAX 00Q25 00Q50 00Q75
1 0.02 0.32 0.11 0.12 0.13 0.02 0.26 0.08 0.09 0.10 0.02 0.28 0.10 0.11 0.12
2 0.02 0.45 0.12 0.13 0.13 0.02 0.20 0.09 0.10 0.11 0.02 0.26 0.11 0.12 0.12
3 0.02 0.29 0.13 0.14 0.14 0.02 0.27 0.11 0.11 0.12 0.02 0.26 0.12 0.13 0.13
4 0.02 0.41 0.13 0.13 0.14 0.02 0.58 0.10 0.11 0.12 0.02 0.34 0.12 0.13 …Run Code Online (Sandbox Code Playgroud) 这是一个 data.frame,其第三个“列”实际上是一个矩阵:
pred.Alb <- structure(list(Age =
c(20, 30, 40, 50, 60, 70, 80, 20, 30, 40,
50, 60, 70, 80), Sex = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L,
2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("Male", "Female"),
class = "factor"),
pred = structure(c(4.34976914720261, 4.3165897157342, 4.2834102842658,
4.23952109360855, 4.15279286619591, 4.05535487959442, 3.95791689299294,
4.02417706540447, 4.05661037005163, 4.08904367469879, 4.0942071858864,
3.9902915232358, 3.85910606712565, 3.72792061101549, 4.37709246711838,
4.38914906337186, 4.40120565962535, 4.3964228776405, 4.32428258270227,
4.23530290952571, 4.14632323634915, 4.3, 4.3, 4.3, 4.28809523809524,
4.22857142857143, 4.15714285714286, 4.08571428571429, 4.59781730640631,
4.59910124381436, 4.60038518122242, 4.58132673532165, 4.48089875618564,
4.36012839374081, 4.23935803129598, …Run Code Online (Sandbox Code Playgroud) I often deal with time series data with timescales of years, months, days, minutes, and seconds. When plotting, it would be convenient to easily change the way the time series axes are displayed, along the lines of a strptime command.
library(lattice)
t_ini = "2013-01-01"
ts = as.POSIXct(t_ini)+seq(0,60*60*24,60*60)
y = runif(length(ts))
# default plot with time series axis in M D h:m
xyplot(y~ts)
# this attempt at using format to display only hours on the x-axis does not work:
xyplot(y~ts, scales=list(x=list(labels=format("%H")))) …Run Code Online (Sandbox Code Playgroud) 我试图在格子图中的每个面板上添加几条黄土线。每条黄土线代表不同级别的 Spe 柱。这是我的数据集的链接:
https://gist.github.com/plxsas/4756fc8d8e50f62acf4d
你能帮我一下吗?
my.col1<- c("white", "darkgray", "black", "lightgray", "ivory2")
my.col2<- c("white", "darkgray", "black", "lightgray", "ivory2")
labels<- c("H", "A", "E", "Q", "T")
xyplot(Total~Months|Site,data=data, groups=Spe, layout=c(3,1), index.cond=list(c(1,2,3)),
par.settings = list(superpose.polygon = list(col=c(my.col1, my.col2))), superpose.line=list(col=c(my.col1, my.col2)),
ylab="Individuals", xlab="Months",
scales=list(x=list(rot=90, alternating=1,labels=c("Jan-12", "Feb-12", "Mar-12", "Apr-12", "May-12", "Jun-12",
"Jul-12", "Aug-12", "Sep-12", "Oct-12", "Nov-12", "Dec-12", "Jan-13"))),
auto.key=list(space="top", columns=3, cex=.8,between.columns = 1,font=3,
rectangles=FALSE, points=TRUE, labels=labels),
panel = function(x, y, ...){
panel.xyplot(x, y, ...)
panel.loess(x, y, span = 1/2)
})
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用RInside在C++中构建一个R应用程序.我想使用代码将图表保存为指定目录中的图像,
png(filename = "filename", width = 600, height = 400)
xyplot(data ~ year | segment, data = dataset, layout = c(1,3),
type = c("l", "p"), ylab = "Y Label", xlab = "X Label",
main = "Title of the Plot")
dev.off()
Run Code Online (Sandbox Code Playgroud)
png如果直接从R运行,它会在指定目录中创建一个文件.但是使用来自RInside的C++调用,我无法重现相同的结果.(我可以使用C++调用重现所有基础图.仅使用Lattice和ggplots的问题)
我也使用以下代码,
myplot <- xyplot(data ~ year | segment, data = dataset, layout = c(1,3),
type = c("l", "p"), ylab = "Y Label", xlab = "X Label",
main = "Title of the Plot")
trellis.device(device = "png", filename …Run Code Online (Sandbox Code Playgroud) 我正在使用lsmipfrom lsmeans来绘制我的模型,
library(lsmeans)
PhWs1 <- lsmip(GausNugget1, Photoperiod:Ws ~ Month,
ylab = "Observed log(number of leaves)", xlab = "Month",
main = "Interaction between Photoperiod and Water stress over the months (3 photoperiods)",
par.settings = list(fontsize = list(text = 15, points = 10)))
Run Code Online (Sandbox Code Playgroud)
但是我无法在互联网上获得有关如何处理图例位置、大小、标题等的建议。我曾经trellis.par.get()查看过参数,但找不到与我的问题相关的参数。从图中可以看出,图例应为“Photoperiod*Ws”,但 Ws 不可见。