Tag Archive for 'parameters'

Change properties of ggplot plots

Try

?ggopt

to see the different ways of adjusting plot background, axes, aspect ratio, border colors, and strip labels.

Change the font size of the labels.

This acts on the currently active plot.

grid.gedit('label', gp=gpar(fontsize=16))

Or just change one type of label (here, the yaxis).

grid.gedit(gPath("yaxis", "labels"), gp=gpar(col="red"))

Use a black and white theme

The newest version of ggplot2 (0.5.7) allows you to have black and white themes.

pl = ggplot(diamonds)+aes(x=carat, y=price) +
    geom_point()+theme_bw
pl

I like to tweak the theme_bw a little before using it as above:

theme_bw$grid.colour = "grey80"
theme_bw$border.colour = "gray70"

Change the strip labels

pl$strip.gp = gpar(fill="grey90")
pl$strip.txt.gp = gpar(col="black", fontsize=16)
pl

Change factor colors to grayscale

pl+scale_colour_grey(end=0.7,start=0,name='')
pl