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
1
vote
1 answer

ggtext formatting getting messed up with ggsave

I am using ggtext::element_textbook_simple to include a bit of filler text in a plot as it has great functionality around word wrapping for long strings. When I run the code directly in markdown, I get a nice plot with even spacing between all…
DJC
  • 1,491
  • 6
  • 19
1
vote
0 answers

Single spaces are displayed as double spaces after using element_markdown() in plot.title

I'm having an issue similar to this person's: (ggtext creates excessive white space between subtitle and title). This is happening in all cases in which I try to create a figure using ggplot2 (bar charts, maps...). Here is a reprex: df <-…
Hugo
  • 11
  • 2
1
vote
2 answers

Add white spaces between two words in a label using ggtext

I using the ggtext package for formatting the axis labels of a plot made by ggplot2, specifically the function element_textbox_simple(), and I have some issues with the html format to introduce white spaces or a blank space between words. In the…
Cristóbal Alcázar
  • 1,153
  • 14
  • 26
1
vote
2 answers

how to use ggtext to color axis data labels in r?

I have come across ggtext package from https://wilkelab.org/ggtext/ to color axis data labels using element_markdown() and tried to color my axis labels but failed. Code (without…
ViSa
  • 1,563
  • 8
  • 30
1
vote
1 answer

ggplot2 Markdown in theme elements. Combining two columns to make one tick label with different fonts

I am trying to apply this solution https://github.com/wilkelab/ggtext to my data to create tick labels from a combination of two columns and apply different fonts to each. I think I've adapted the example code to my scenario but am getting this…
Lisa B
  • 85
  • 6
1
vote
2 answers

Subscripts in tick labels with a discrete variable mapped to x

I was wondering how to put a subscript in my x-axis tick labels. Not in the axis label, as in most other posts, hence from the values already in the data frame. Here is a reproducible code example, I would like the letters in brackets to be…
Viv31
  • 13
  • 2
1
vote
1 answer

Different font sizes for different portions of text label in ggplot

A Data sample has been provided, please scroll to the bottom I have followed these instructions but I cannot get it to function with my script. They seem to be working with labs() and not the approach I have used below. I have produced this…
cmirian
  • 2,572
  • 3
  • 19
  • 59
0
votes
1 answer

ggtext axis title show one letter on top of another

I'm rendering axis title with ggtext using axis.title.y = element_markdown(size = 5, face = "bold"), but it seems to interpret the space wrongly when exported as png image as in the picture below (the last letter of one word is in the same place of…
Alvaro Morales
  • 1,845
  • 3
  • 12
  • 21
0
votes
1 answer

ggplot2 and fontawesome only display an empty rectangle

I try to use some fontawesome icons in a ggplot2 plot. Especially the "fa-temperature-arrow-up" would be interesting for me, but i cannot make it work. I tried the emojifont package, but no success. Can somebody point me to what i am…
SEMson
  • 1,285
  • 3
  • 20
  • 25
0
votes
0 answers

How can I justify the text next to the icons and align it to the pictos using html within ggplot2?

I am trying to create a textbox to accompany a complex visualisation developed in ggplot2. My code is: library(ggplot2) library(ggtext) text<-"How to read this infographic?

There is a block of text here that goes over
several…
Jelo A
  • 39
  • 4
0
votes
1 answer

error when annotating axis labels with custom images in ggplot/ggtext

I am trying to annotate a plot by including custom images as the labels for a discrete x axis. I have used the package ggtext which adds this functionality to ggplot, and while I am able to replicate the example provided in the documentation of…
Myriad
  • 341
  • 1
  • 8
0
votes
0 answers

changing font (from default) to Calibri (or other) and bold the text (ggplot)

I would like to use Calibri instead of Arial and bold the title. I used showtext package and was successfully get calibri font. However, I could not bold the text (as title). I also used ggtext to customize color and font size but was not able to…
Minh Dang
  • 11
  • 1
0
votes
2 answers

Crop images based on number of text length

I have a dataset with a column storing hundreds of writing samples. My goal is to export each writing sample into a separate image. Below, my current code: library(tidyverse) library(ggplot2) library(ggtext) library(magick) df <- data.frame( …
Michael Matta
  • 394
  • 2
  • 16
0
votes
1 answer

Convert a column with text files into separate images in R

I have a dataset with a column storing hundreds of writing samples. My goal is to export each writing sample into a separate image. The code shared in this answer was promising given that it allowed me to convert text into an image. df <-…
Michael Matta
  • 394
  • 2
  • 16
0
votes
1 answer

Using element_markdown() from ggtext to place two captions in a ggplot figure

I am trying to create a ggplot2 figure with two captions, one left-aligned and one right-aligned. This works properly when using element_text() in theme() to format the figures. ggplot(mtcars) + aes(x=cyl, y=disp) + geom_point() + …
Kumar
  • 113
  • 1
  • 5