element_roundrect
The element_roundrect
works like
element_rect
to draw round rectangle background. We can use
it to adjust theme elements, including legend, strip, panel and plot
background.
gglegend
set_font
d <- data.frame(x=rnorm(10), y=rnorm(10), lab=LETTERS[1:10])
p <- ggplot(d, aes(x, y)) + geom_text(aes(label=lab), size=5)
set_font(p, family="Times", fontface="italic", color='firebrick')
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## font family not found in Windows font database
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## font family not found in Windows font database
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## font family not found in Windows font database
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## font family not found in Windows font database
facet_set
Manually specifying facet labels.
library(ggplot2)
library(ggfun)
p <- ggplot(mtcars, aes(disp, drat)) +
geom_point() +
facet_grid(cols=vars(am), rows=vars(cyl))
p + facet_set(label=c(`0`="Zero", `6`="Six"))
Supports labeller:
Add a facet label to a plot.
With the ggplotify
package, we can use facet_set
to add a facet label to
almost any plot in R.