¡Si mira los cuadros here! puedes ver que hay mucho espacio en blanco encima y debajo de la leyenda. Deseo reducir la cantidad de espacio.El espacio encima y debajo de la leyenda usando ggplot2
código Ejemplo:
library(ggplot2)
library(gridExtra)
library(reshape)
library(plyr)
library(scales)
theme_set(theme_bw())
rows <- 1:nrow(faithful)
data <- cbind(faithful, rows)
molten <- melt(data, id.vars='rows', measure.vars=c('eruptions', 'waiting'))
p <- ggplot() +
geom_line(data=molten,
mapping=aes(x=rows, y=value, group=variable, colour=variable), size=0.8) +
scale_colour_manual(values=c('red','blue')) +
opts(title='Title') +
xlab(NULL) + ylab('Meaningless Numbers') +
opts(
legend.position='bottom',
legend.direction='horizontal',
legend.title=theme_blank(),
legend.key=theme_blank(),
legend.text=theme_text(size=9),
legend.margin = unit(0, "line"),
legend.key.height=unit(0.6,"line"),
legend.background = theme_rect(colour='white', size=0)
)
ggsave(p, width=8, height=4, filename='crap.png', dpi=125)
¿Así que, fundamentalmente, me estás diciendo que hay un campo alrededor de la leyenda de lo que no me puedo deshacer? Solo puedo hacer que algunos parezcan no estar allí. –
No digo que haya un relleno del que no puedas deshacerte. Solo digo que mi solución es lo mejor que puedo hacer. Sin duda, alguien más puede hacerlo mejor. – Andrie