Wie Sie Titel position in ggplot2
Hier ist der code:
require(ggplot2)
require(grid)
# pdf("a.pdf")
png('a.png')
a <- qplot(date, unemploy, data = economics, geom = "line") + opts(title='A')
b <- qplot(uempmed, unemploy, data = economics) + geom_smooth(se = F) + opts(title='B')
c <- qplot(uempmed, unemploy, data = economics, geom="path") + opts(title='C')
grid.newpage()
pushViewport(viewport(layout = grid.layout(2, 2)))
vplayout <- function(x, y) viewport(layout.pos.row = x, layout.pos.col = y)
print(a, vp = vplayout(1, 1:2))
print(b, vp = vplayout(2, 1))
print(c, vp = vplayout(2, 2))
dev.off()
Und Ergebnis:
Während hier ist, was ich haben möchte, also auf position Titeln in der Nähe der Spitze der y-Achse:
InformationsquelleAutor qed | 2013-10-27
Du musst angemeldet sein, um einen Kommentar abzugeben.
Was Sie suchen, ist
theme(plot.title = element_text(hjust = 0))
. Zum Beispiel mit der neuesten version von ggplot2 undtheme
stattopts
wir habenAlternativ zu bleiben mit
opts
opts
statttheme
Wie würde ich mich über die Einstellung der Titel, so dass es innerhalb der Handlung? Ich habe versucht 'vjust', aber es funktioniert nicht in Kombination mit 'hjust'. Ich bin auf der Suche, um verschieben Sie den Titel an der rechten oberen Ecke innerhalb der Handlung.
Ich glaube nicht, dass es eine ähnliche Lösung für Ihr problem; Sie sollten erwägen Sie, das Eigentum an dem Grundstück einfach als text, als in stackoverflow.com/questions/14928711/...
InformationsquelleAutor Julius Vainora