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
0
votes
1 answer

R ggplot2 Customizing date axis labels with different colors

I would like to color the date axis labels considering some conditions. Here is an example: # Libraries library("ggplot2") library("lubridate") # Create data data0 <- data.frame(dt = seq(as.Date('2022-01-01'),as.Date('2022-01-20'),1)) data0$y <-…
giordano
  • 2,954
  • 7
  • 35
  • 57
0
votes
0 answers

ggtext element_markdown not styling anything on new macbook

I'm using some very basic styling of ggplot text, and using ggtext and element_markdown to style them. This type of code seems like it should work, but for some reason it just doesn't work on my macbook. I'm wondering if this is something to do with…
Jamie
  • 401
  • 3
  • 11
0
votes
1 answer

Can't italicize ggplot label/titles & ggtext not working after R update

I was able to use ggtext as well as the mdthemes::md_theme_classic() options to control ggplot text formatting in the past. However, after an R update today, my codes run without error but the formatting will not be displayed in the plots. For…
Xuewen
  • 1
  • 1
0
votes
1 answer

How to create a text only plot in RStudio

This is likely a very silly question but I can't seem to find anything online in regards to creating a plot in RStudio but the plot only having text. I am trying to generate a plot via RStudio that simulates the attached photo. I believe ggplot is…
0
votes
1 answer

How can I write axis ticks in small capital using ggtext?

I want to write axis ticks in small capital using ggtext::element_markdown(). However, an attempt like small capital here! is in vain. Then, how should I achieve that…
Carlos Luis Rivera
  • 3,108
  • 18
  • 45
0
votes
1 answer

Add % labels to pie chart ggplot2 after specifying factor orders

I have a data frame from which I want to make a pie chart that shows the % label Here's what I did first SubSegment<- c('S1','S2','S3','S4') v <- c(100, 300, 500, 200) df<- cbind.data.frame(SubSegment, v) #calculations for % labels in chart df <-…
lu-202
  • 121
  • 7
0
votes
1 answer

Rendering `%` using element_markdown()

How can I keep the % symbol in the title? library(ggtext) library(ggplot2) ggplot(mtcars, aes(cyl, mpg)) + geom_col() + ggtitle("%") + theme(plot.title = element_markdown()) Created on 2022-01-28 by the reprex package (v2.0.1)
John-Henry
  • 1,556
  • 8
  • 20
0
votes
1 answer

How do I correctly select the label to place on top of the highest point of the Y-axis of a facet-separated plot?

I have a plot which I have separated by facets for each group. At the highest point of the Y axis I want to put the corresponding Y value, for this I am using the ggtext package and the geom_richtext() function. Although I use group = Group within…
Daniel Valencia C.
  • 2,159
  • 2
  • 19
  • 38
0
votes
1 answer

Fixing the position of Text box in plot window in ggplot

I have below ggplot :- library(dplyr) library(ggplot2) library(ggtext) library(ggdist) set.seed(1) DF = rbind(data.frame('Label' = 'A', val = rnorm(200, 5)), data.frame('Label' = 'B', val = rnorm(500, 10))) DF %>% ggplot(aes(x=Label, y=val,…
Brian Smith
  • 1,200
  • 4
  • 16
0
votes
0 answers

How to plot images as y-axis labels using ggtext?

I'm trying to plot some images (football logos) as my y-axis labels using ggtext. However, I get the below error message when I try and view the plot. Error in function (type, msg, asError = TRUE) : I've tried following some online examples on how…
Ben_89
  • 249
  • 1
  • 8
0
votes
1 answer

Unable to color axis labels based on condition using ggtext

I am trying to color x - axis text label by a condition & using ggtext for same but getting error . condition: If State == India then color otherwise black color libs &…
ViSa
  • 1,563
  • 8
  • 30
0
votes
1 answer

Justify Second Column to the right

I was wondering if anyone knows how to align a ggtexttable column to the right? This is a brief example: library(ggpubr) df <- data.frame(Order = c(1:3), Name = c("Adam", "Ben", "Charlie"), Score = c(-.0041, 8.00,…
JK Lambert
  • 333
  • 1
  • 6
0
votes
0 answers

Change the label font size but also changed the x axia labels order when using ggtext

My first question is not completely solved by @teunbrand. He gave me a piece of advice but I'm confused by it. The x axis label is out of order after usting the big_label_md function though I get what I need. Now I want to get the right label order.…
花落思量错
  • 352
  • 1
  • 11
0
votes
1 answer

ggtext::geom_textbox: How to display links as raw text?

I am trying to display web links in a text box (as raw text). However, get an error (and I'm not an HTML expert, unfortunately). This there any way to reformat the web links so that they can be displayed as raw text within the text box?…
Tee
  • 113
  • 1
  • 6
0
votes
1 answer

How do I bold and underline part of a ggplot2 annotation?

I am trying to use the bold() and underline() functions from grDevices within paste() to create an annotation that features a stylized, hardcoded 'title' with a line break followed by a string that could be one or more lines long, and am struggling…
Bryce R.
  • 11
  • 3