Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9074619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T18:40:48+00:00 2026-06-16T18:40:48+00:00

Suppose I have the data and plot as follows: mydata = data.frame(x=rnorm(4), y=runif(4), tau=c(0,0,1,1))

  • 0

Suppose I have the data and plot as follows:

mydata = data.frame(x=rnorm(4), y=runif(4), tau=c(0,0,1,1))
ggplot(mydata) + geom_point(aes(x=x, y=y)) + facet_wrap(~ tau)

I would like the facet labels to read “tau=0” and “tau=1”, respectively, with tau formatted as its greek symbol. I know from another question that using the labeller label_parsed will format the letter tau by itself, but the equal sign seems to complicate things. An ideal solution would not require me to change the data (i.e. make tau a factor and name its levels), but I will take whatever works 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T18:40:49+00:00Added an answer on June 16, 2026 at 6:40 pm

    here a solution with facet_grid adn indexing the tau by its levels.

    mydata = data.frame(x=rnorm(4), y=runif(4), tau=c(0,0,1,1))
    ggplot(mydata) + geom_point(aes(x=x, y=y)) +
             facet_grid(~ tau,labeller = label_bquote(tau ^ .(x)))
    

    enter image description here

    Edit To get the “tau=0” and “tau=1”

    facet_grid(~ tau,labeller = label_bquote(tau == .(x)))
    

    Edit2 second variable sigma

    I find this solution, by defining a custom labeller. Hope someone ( ggplot2 guys ) give me a simpler solution.

    enter image description here

    my.label_bquote <- function (expr1 = (tau == .(x)),expr2 = (sigma == .(x))) 
    {
       quoted1<- substitute(expr1)
       quoted2 <- substitute(expr2)
       function(variable, value) {
          value <- as.character(value)
          if(variable == 'tau')
             lapply(value, function(x)
                   eval(substitute(bquote(expr1, list(x = x)),list(expr1 = quoted1))))
          else
             lapply(value, function(x) 
                   eval(substitute(bquote(expr2, list(x = x)),list(expr2 = quoted2))))
       }
    }
    
    mydata = data.frame(x=rnorm(4), y=runif(4), tau=c(0,0,1,1),sigma=c(2,2,3,3))
    ggplot(mydata) + geom_point(aes(x=x, y=y)) +
      facet_grid(sigma ~ tau,labeller = my.label_bquote())
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have the following data frame: Data1 X1 X2 1 15 1 2
Suppose I have some data stored in a container of unique_ptr s: struct MyData
Suppose I have a data frame with columns c1, ..., cn, and a function
Suppose I have a data.frame with N rows. The id column has 10 unique
Suppose I have a data.frame that's completely numeric . If I make one entry
Suppose I have a file with two columns of data file.dat . I would
Suppose I have a data.frame called SLV and I apply the tail()function. I will
Suppose you have a data frame with the following structure: df <- data.frame(a=c(1,2,3,4), b=c(job1;job2,
Suppose I have two data frame 'df_a' & 'df_b' , both have the same
Suppose I have a data frame in R that has names of students in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.