Learn R Programming

ggfun (version 0.1.8)

set_font: set_font

Description

setting font for ggplot (axis text, label, title, etc.)

Usage

set_font(p, family = "sans", fontface = NULL, size = NULL, color = NULL)

Value

TableGrob object

Arguments

p

ggplot object

family

font fammily

fontface

font face

size

font size

color

font color

Author

Guangchuang Yu

Examples

Run this code
library(grid)
library(ggplot2)
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')

Run the code above in your browser using DataLab