Skip to content

ggtext and parsing html with latest version of ggplot #6752

@Philip-Leftwich

Description

@Philip-Leftwich

I found a problem with ggplot and rendering html text with ggtext or marquee

I expected to parse character string in html format and have the style implemented.
This works for my code in ggplot 3.5.2 but not in ggplot 4.0.0

Here is the code to reproduce the bug:

library(ggplot2)
library(ggtext)

# Minimal dataframe
df <- data.frame(
  gRNA_type = rep(c("cd<sup><i>g338-384</i></sup>", 
                    "wt<sup><i>control</i></sup>"), each = 5),
  win = c(95, 88, 92, 90, 94, 45, 50, 48, 52, 47),
  loss = c(5, 12, 8, 10, 6, 55, 50, 52, 48, 53),
  id = 1:10
)

# Test plot
ggplot(df, aes(x = gRNA_type, y = win)) +
  geom_point() +
  theme_minimal() +
  theme(axis.text.x = element_markdown())

Created on 2025-11-19 with reprex v2.1.1

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions