10

I know that after I create a ggplot graph I can use theme_get() to return detail of all the theme elements. This has been very helpful in figuring out things like strip.text.x and the like. But I have two things I can't figure out:

1) In the following ggplot graphic, what is the name of the theme item representing the phrase "Percent of wood chucked by the woodchuck" as I want to resize it to a larger font:

enter image description here

2) How do I reformat the y axis labels to read 10%, 20, ... instead of .1, .2, ...

2 Answers 2

8

For 1), it is $axis.title.y

p + theme(axis.title.x = element_text(size = 25))

where p is an existing ggplot object.

I don't know about 2) off hand.

Sign up to request clarification or add additional context in comments.

Comments

4

For (2) what you want is to use a formatter:

dat <- data.frame(x=1:10,y=1:10)

#For ggplot2 0.8.9    
ggplot(dat,aes(x = x/10,y=y/10)) + 
    geom_point() +
    scale_x_continuous(formatter = "percent")

#For ggplot2 0.9.0    
ggplot(dat,aes(x = x/10,y=y/10)) + 
    geom_point() +
    scale_x_continuous(labels = percent_format())

enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.