ggtext

Using ggplot geom_text when combining superscript and variable label that contains < symbol

喜夏-厌秋 提交于 2021-01-05 09:06:08
问题 I am having trouble adding R2 annotations to a faceted plot, where my R2 values are sometimes <0.01 (yes, it's not a good regression). I would like the 2 of R2 to be superscript. I have tried several options but seem to be stymied by the < symbol in my values eg, using the iris data set, I first set up a new data frame with my R2 values previously calculated. The x & y positions are also set up as these are different for every facet (not essential for the iris dataset, but it is for mine)

Using ggplot geom_text when combining superscript and variable label that contains < symbol

不羁岁月 提交于 2021-01-05 09:02:04
问题 I am having trouble adding R2 annotations to a faceted plot, where my R2 values are sometimes <0.01 (yes, it's not a good regression). I would like the 2 of R2 to be superscript. I have tried several options but seem to be stymied by the < symbol in my values eg, using the iris data set, I first set up a new data frame with my R2 values previously calculated. The x & y positions are also set up as these are different for every facet (not essential for the iris dataset, but it is for mine)

ggplot2: italics in the legend

柔情痞子 提交于 2020-01-05 04:08:09
问题 I'm trying to edit the labels in the legend so that the first label (WT) is in plain text, whilst the subsequent 7 are in italics. I have been using element_text(face=c("plain", rep("italic",7))) , but this has resulted in none of the labels being converted to italics. I'm a bit confused why it hasn't worked because element_text(face="italic") converts all the labels into italics. My plot is as follows: library(tidyverse) for_plot <- read_csv(file = "Row, Time, Mutant, Mean 1, 1, ppi1, 0.8008