Menu
  • HOME
  • TAGS

Multiple indices in ggplot label

r,ggplot2,plotmath

The following does that: ggplot(data, aes(x=A, y=B)) + geom_bar(stat="identity", colour="black", position="dodge", size=0.25, width=0.8, alpha=0.8) + annotate("text", x=1, y=2.5, label="~a[1]~a[2]~a[3]", parse=TRUE) ...

Plotmath: concatenating (joining) a greek character to a roman character

r,plotmath

You can try plot(1, main = expression(mu*g~Toxin/gram~Fresh~Weight)) ...

Displaying values from a character vector as italic labels in boxplot in R

r,boxplot,plotmath

Create the following function and use it as shown: make.italic <- function(x) as.expression(lapply(x, function(y) bquote(italic(.(y))))) boxplot(split(x, cut(x,breaks = c(-Inf, 0, Inf))), names = make.italic(sNames)) which gives: ...

adjusting line height of a multi-line expression() statement with grid or lattice graphics

r,expression,lattice,plotmath

you could try with gtable library(gtable) library(grid) grid.expr <- function(labels, ..., width=NULL, heights=NULL, margin=unit(0.5,"line")){ gl <- lapply(labels, textGrob, ...) if(is.null(heights)) heights <- do.call(unit.c, lapply(gl, grobHeight)) + margin widths <- do.call(max, lapply(gl, grobWidth)) gt <- gtable_matrix("table", grobs = matrix(gl,ncol=1), widths=widths, heights=heights) grid.draw(gt) } grid.newpage() grid.expr(LETTERS[1:5], heights=unit(1:5,"line")) ...