Hello all, I've been using the following qplot command: qplot(pixX,pixY, data=som, geom="tile", fill=rgb) + scale_fill_identity() + opts(aspect.ratio = .75) + facet_grid(unitX ~ unitY) Now I would like to convert it into the explicit ggplot grammar, so I can remove the extras: axes, labels, background, borders, facet labels, and extra white-space around the plot. (If anyone has suggestions on removing these please let me know) I've come up with the following but it is not behaving the same way as the qplot above: ggplot(data = somdf, mapping = aes(x = pixX, y = pixY)) + layer(data = somdf, geom = "tile", fill=rgb) + scale_y_continuous(name=" ",breaks=" ") + scale_x_continuous(name=" ",breaks=" ") + scale_fill_identity() + coord_cartesian() + opts(aspect.ratio = .75) + facet_grid(unitX ~ unitY,margins=FALSE) The result is a plot where all tiles are filled with grey50, and not the data values. I've also tried this variation with the same results: ggplot(data = somdf, mapping = aes(x = pixX, y = pixY)) + geom_tile(data = somdf, fill=rgb) + scale_y_continuous(name=" ",breaks=" ") + scale_x_continuous(name=" ",breaks=" ") + scale_fill_identity() + coord_cartesian() + opts(aspect.ratio = .75) + facet_grid(unitX ~ unitY,margins=FALSE) The other issue I'm having is that the above seems to create multiple plots, another, apparently identical, plot gets drawn after I call dev.off(). I have no idea why this would be so. Setting name and breaks to " " seems like a hack to get rid of the axis stuff, is there a better way? Oh, and I can't find documentation for opts() on the ggplot2 website, where is it available? Thanks all, Hadley in particular, B. Bogart
Hello all, I've been using the following qplot command: qplot(pixX,pixY, data=som, geom="tile", fill=rgb) + scale_fill_identity() + opts(aspect.ratio = .75) + facet_grid(unitX ~ unitY) Now I would like to convert it into the explicit ggplot grammar, so I can remove the extras: axes, labels, background, borders, facet labels, and extra white-space around the plot. (If anyone has suggestions on removing these please let me know) I've come up with the following but it is not behaving the same way as the qplot above: ggplot(data = somdf, mapping = aes(x = pixX, y = pixY)) + layer(data = somdf, geom = "tile", fill=rgb) + scale_y_continuous(name=" ",breaks=" ") + scale_x_continuous(name=" ",breaks=" ") + scale_fill_identity() + coord_cartesian() + opts(aspect.ratio = .75) + facet_grid(unitX ~ unitY,margins=FALSE) The result is a plot where all tiles are filled with grey50, and not the data values. I've also tried this variation with the same results: ggplot(data = somdf, mapping = aes(x = pixX, y = pixY)) + geom_tile(data = somdf, fill=rgb) + scale_y_continuous(name=" ",breaks=" ") + scale_x_continuous(name=" ",breaks=" ") + scale_fill_identity() + coord_cartesian() + opts(aspect.ratio = .75) + facet_grid(unitX ~ unitY,margins=FALSE) The other issue I'm having is that the above seems to create multiple plots, another, apparently identical, plot gets drawn after I call dev.off(). I have no idea why this would be so. Setting name and breaks to " " seems like a hack to get rid of the axis stuff, is there a better way? Oh, and I can't find documentation for opts() on the ggplot2 website, where is it available? Thanks all, Hadley in particular, B. Bogart
Reasonably Related Threads
- ggplot2 - deprecated guide= argument in
- jpeg() creating empty files with qplot() in a loop
- ggplot2: labels and breaks order does not match and I can't use scale_fill_identity
- ggplot2 - legend for fill coulours
- [LLVMdev] Unexpected behaviour of the LLVM gold plugin with --allow-multiple-definition