【发布时间】:2014-08-16 18:18:14
【问题描述】:
当我尝试在对数尺度散点图的格中使用 panel.text(或 ltext)添加文本时遇到了这个问题。我知道对于正常情节,您会使用:
attach(mtcars) # using the mtcars as an example:
mytext<- paste("text here")
xyplot(mpg~wt, scales=list(cex=.8, col="red"),
xlab="Weight", ylab="Miles per Gallon",
main="MGP vs Weight by Horse Power",
panel=function(x, y, ...) {
panel.xyplot(x, y, ...);
ltext(4.5, 15, labels=mytext, cex=2)}
)
如果我对对数比例图执行相同操作,则不会显示文本。
xyplot(mpg~wt, scales=list(cex=.8, col="red",
x = list(log = T), y = list(log = T)),
xlab="Weight", ylab="Miles per Gallon",
main="MGP vs Weight by Horse Power",
panel=function(x, y, ...) {
panel.xyplot(x, y, ...);
ltext(4.5, 15, labels=mytext, cex=2)}
)
有什么建议吗?谢谢!
【问题讨论】:
-
你能提供一个可重现的例子吗?人们会更容易帮助您解决问题。
-
对不起,我上次没有把我的问题说清楚。现在这个例子应该做到了!谢谢 SimonG。
标签: r lattice scatter-plot