绘图窗口的总标题 [英] Overall Title for Plotting Window
问题描述
如果我在R中创建一个具有m行和n列的绘图窗口,我怎么能给整体图形设置一个主标题?
例如,I可能有三张散点图显示了3所不同学校的GPA和SAT分数之间的关系。我怎样才能给所有三个地块提供一个主标题,例如CA中的3所学校的SAT分数与GPA比较? 解决方案我想到的最明显的方法是使用Lattice或ggplot2。这里有一个使用格子的例子:
pre $ library(lattice)
depthgroup <-equal.count(quakes $ depth,number = 3,overlap = 0)
magnitude< -equal.count(地震$ mag,number = 2,overlap = 0)
xyplot(lat_long | depthgroup * magnitude,
data =地震,
main =Fiji Earthquakes,
ylab =latitude,xlab =longitude,
pch =。,
scales = list(x = list (交替= c(1,1,1))),
之间= list(y = 1),
par.strip.text = list(cex = 0.7),
par。设置= list(axis.text = list(cex = 0.7)))
main =参数。
上述示例已从这里。
我没有一个好的ggplot2例子,但是在学习r博客。
一个选项可能是这个例子他们使用ggplot2和
opts(title =RSS和NINO3.4温度异常\和1980年以来的SATO指数趋势)
但是你自然会得到在gg2plot中创建的所有三张图。
我认为你应该可以使用格或ggplot2。
If I create a plotting window in R with m rows and n columns, how can I give the "overall" graphic a main title?
For example, I might have three scatterplots showing the relationship between GPA and SAT score for 3 different schools. How could I give one master title to all three plots, such as, "SAT score vs. GPA for 3 schools in CA"?
The most obvious methods that come to my mind are to use either Lattice or ggplot2. Here's an example using lattice:
library(lattice)
depthgroup<-equal.count(quakes$depth, number=3, overlap=0)
magnitude<-equal.count(quakes$mag, number=2, overlap=0)
xyplot(lat ~ long | depthgroup*magnitude,
data=quakes,
main="Fiji Earthquakes",
ylab="latitude", xlab="longitude",
pch=".",
scales=list(x=list(alternating=c(1,1,1))),
between=list(y=1),
par.strip.text=list(cex=0.7),
par.settings=list(axis.text=list(cex=0.7)))
In lattice you would change the main= parameter.
The above example was lifted from here.
I don't have a good ggplot2 example, but there are a metricasston of examples with ggpolot2 over at the learn r blog.
One option might be this example where they use ggplot2 and
opts (title = "RSS and NINO3.4 Temperature Anomalies \nand SATO Index Trends Since 1980")
But you would have to have all three graphs created in gg2plot, naturally.
I think you should be fine with either lattice or ggplot2.
这篇关于绘图窗口的总标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!