I use
frame <- read.table(paste('data', fname, sep="/"), sep=",", header=TRUE)
colnames(frame) <- c("pos", "word.length")
plot <- ggplot(frame, aes(x=pos, y=word.length)) + xlim(0,20) + ylim(0,20) + geom_density2d() + stat_density2d(aes(color=..level..))
png(paste("graphs/", fname, ".png", sep=""), width=600, height=600)
print(plot)
dev.off()
to create plots, but they get cut off. How do I fix this?
http://ompldr.org/vZTN0eQ
The data I used to create this plot: http://sprunge.us/gKiL
According to the ggplot2 book, you use scale_x_continuous(limits=c(1,20))
instead of xlim(1,20)
for that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With