0

I am trying to rename the group names in a stripchart. I have tried using bquote and expression, but ran into the same problem. Everything within the brackets following expression is printed as a group label without formatting (so in the example below I am getting a label that reads "Delta ~ "Group1"".

I've tried combining expression and paste, but that gave me a label that read "paste(Delta, "Group1")".

stripchart(Df$value~Df$Treatment , 
    vertical = TRUE,
    group.names = c(expression(Delta ~ "Group1"), "Group2"),
HarD
  • 183
  • 9

1 Answers1

1

Try setting your group.names=NA and then using the axis command to add the group.names afterwards.

I couldn't reproduce your example but if you do something like:

## define what you want your group.names to be using expression     
group_names=c(expression(Delta==1),expression(Delta==2),expression(Delta==3),expression(Delta==4),expression(Delta==5))

## make your strip chart
stripchart(Temp~Month, data=airquality,group.names=NA,vertical=TRUE)

## add the lower axis labels, which equivalently adds the group.names
axis(1,at=1:5,labels=group_names)
Alex Witsil
  • 855
  • 8
  • 22
  • That worked perfectly! Thanks for the help. Do you know why my original code wouldn't work? – HarD Sep 23 '16 at 16:53