Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0613· openaiHugging Face Suzhen/CodeChat

in ggplot, how to bold the title from facet_wrap?

  1. User

    in ggplot, how to bold the title from facet_wrap?

  2. Assistant

    To bold the title from facet_wrap in ggplot2, you can use the theme() function to modify the appearance of the text.

    Here is an example:

    library(ggplot2)
    
    # Create a sample data frame
    data <- data.frame(
      x = rnorm(100),
      y = rnorm(100),
      group = rep(c("Group A", "Group B"), 50)
    )
    
    # Create a scatter plot with facet_wrap
    p <- ggplot(data, aes(x = x, y = y)) +
      geom_point() +
      facet_wrap(~ group)
    
    # Modify the appearance of the facet titleLabel
    p + theme(strip.text = element_text(face = "bold"))
    

    In this example, the strip.text argument in the theme() function is used to modify the appearance of the facet title text. The "bold" argument is passed to the face parameter to make the text bold.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.