table_plot: Draw a Textual Table

View source: R/table_plot.R

table_plotR Documentation

Draw a Textual Table

Description

Draw a Textual Table

Usage

table_plot(
  table,
  theme = "grey",
  size = 10,
  row = NULL,
  col = NULL,
  color = "#D04042",
  ...
)

Arguments

table

a data frame

theme

the type of theme, one of grey, blue, red, violet, cyan, and triline

size

the size of text in the table

row

a numeric vector of row indexes

col

a numeric vector of column indexes

color

text font color

...

extra parameters for text justification

Value

an object of class ggplot.

Examples

df <- data.frame(A = 1:2, B = letters[1:2])
df$B <- c("italic(α\u03b2)", "bold(adonis) (bold(italic(R))^bold(`2`))")
colnames(df) <- c("bold(p.value)", "italic(p.adj[2]^3)")
table_plot(table = df, theme = "blue")
p2 <- table_plot(table = df, theme = "triline", row = 2, col = 2, color = "purple")
p1 <- table_plot(table = df, theme = "violet", row = 2:3, col = 2, size = 16, color = "darkblue")
gfun:::Greek_alphabet()  |> groutable::dt2()
p <- ggplot(data=  data.frame(x=1:24,y=1:24), aes(x = x,y = y)) +
geom_point(shape = gfun:::Greek_alphabet()$lower, size = 8) +
  theme_prism(angle = 0) +
  ylab(bquote(bold(paste("TNF ",alpha^2," (pg/mL)")))) +
  xlab(bquote(Assimilation (mu~ mol ~CO[2]~ m^-2~s^-1))) +#
  labs(title = expression(bold(log[10]^2)),
       subtitle = "δφυαμΣ\u03b2",
       caption = expression(bold(adonis) (bold(italic(R))[3]^bold(`2`))))
pp <- p + anno_plot("plot", x = 12, y = 45, label = p2) +
  anno_plot("plot", x = 2, y = 45, label = p1)
grDevices::dev.off()
ggsave("image.pdf", width = 8, height = 5, device = cairo_pdf, plot = pp)

ZhonghuiGai/gfun documentation built on Feb. 10, 2023, 6:10 p.m.