Questions tagged [ggtext]

Advanced text formatting in ggplot2, enables the rendering of complex formatted plot labels.

The ggtext package enables using (a limited subset of) Markdown and HTML syntax in ggplot2 plot labels.

Repositories:

77 questions
2
votes
3 answers

ggplot2: italics in the legend

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…
Tanya
  • 37
  • 1
  • 4
2
votes
2 answers

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

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…
Jenni G
  • 35
  • 1
  • 4
2
votes
1 answer

How to print lowercase Greek delta in italics [ggplot axis titles]

I'm plotting stable isotope data in R with the ggplot2 package and wish to have the lowercase delta symbols on the axis titles printed in italics. I am using expression() to build the axis titles but the delta symbol will not print in italics when…
Jordan
  • 173
  • 1
  • 2
  • 9
1
vote
0 answers

Word spacing too close when using element_textbox with imported fonts

I like to use element_textbox from the ggtext package as it provides automatic line breaks when captions get too long. However, when combined with the font that I'm using - Public Sans https://fonts.google.com/specimen/Public+Sans - the spacing…
tgod7258
  • 35
  • 4
1
vote
0 answers

Use ggtext to ggplot graphic but can not display superscript ^

I use this code for display the graphic but -1 can no t display like superscript, can you help NOTE: I used boxplot groups #install.packages("ggtext") library(ggtext) ggplot(pesosip,aes(x=Treatment,y=PESO..gr.,fill=Weight.record))+ …
Atomix
  • 11
  • 1
1
vote
0 answers

Is it possible to use ggtext to plot symbols on top of each other?

I try to use geom_richtext of the "ggtext" package to create my labels and I want to plot a number and a letter on top of each other. But I don't know whether this is even possible with "ggtext" yet. I could only achieve the desired layout with the…
maRvin
  • 249
  • 1
  • 11
1
vote
1 answer

ggtext: ggplot2-rendering with element_markdown()

I'm trying to create a ggplot with markdown text in the plot title, subtitle, the caption and in the legend text. The legend text is dependent on a variable, which there is thus and ifelse-statement in the making of the legend text. In one of the…
OMMJREN
  • 57
  • 7
1
vote
2 answers

Overline in ggplot axis label

I'm trying to create some ggplot with overlined axis title. Using a reproducible example, my code is: library(ggplot2) library(ggtext) data("iris") ggplot(iris, aes(Sepal.Length, Sepal.Width)) + geom_point() + xlab("
msfrn
  • 57
  • 3
1
vote
1 answer

Error rendering spaces in bold title using ggtext and ggplot2

I just updated my R to version 4.2. Ggtext, which was working fine until then now erase white spaces between words if the text is bold. I found a very similar question on RStudio forum but not a solution for me. A reproducible example would be as…
Arthur Welle
  • 586
  • 5
  • 15
1
vote
1 answer

How to format selected axis text words with italic and bold using ggtext

Any guidance on getting bold and italic formatted axis text using ggtext would be appreciated. Possibly a problem due to my set up or is something missing? What I've tried library(ggplot2) library(ggtext) df1 <- data.frame(var1 = c("italic…
Peter
  • 11,500
  • 5
  • 21
  • 31
1
vote
1 answer

How to wrap facet labels using ggtext element_textbox

I'm using element_textbox_simple() from ggtext to wrap facet labels in my ggplot2 theme. But the strip height doesn't seem to increase with the additional lines. How do I get the textbox to wrap correctly? I've considered using the labeller =…
tgod7258
  • 35
  • 4
1
vote
0 answers

gridtext::element_markdown doesn't apply margin with css selector

I'm trying to define different margins for x-axis labels in ggplot2 using css syntax, as allowed by ggtext package. I created an object with the CSS selector and used element_markdown() for axis.text.x. However, nothing happens to the plot. Here is…
1
vote
1 answer

Multiple ggtext Markdown Annotations in ggplot2 Take Long Time to Render/Don't Render

I have been using Claus Wilke's great ggtext package for markdown annotations for a while now, and until now it's worked perfectly. In the course of using ggtext to make multiple text annotations (mix of bold face and regular text on multiple…
kpivert
  • 11
  • 2
1
vote
1 answer

Why my code for using png logos in axis labels in ggtext is not working

I am trying to learn 'Improving Visualisations in R' presently following this fabulous post. For the first part it seems working greatly. But the part where axis text is replaced by logos is not working. The error displayed is - Error in…
AnilGoyal
  • 25,297
  • 4
  • 27
  • 45
1
vote
0 answers

Rotate strip text with ggtext

I'm trying to make a plot with a two layer strip. I want the first layer of strips to have a horizontal text orientation and the second layer to have a vertical text orientation. In the example below, I want the strip layers that say 'horizontal' to…
teunbrand
  • 33,645
  • 4
  • 37
  • 63